Make WordPress Core


Ignore:
Timestamp:
04/12/2022 03:10:30 PM (3 years ago)
Author:
gziolo
Message:

Editor: Update WordPress packages based based on Gutenberg v13.0 RC3

This is the last step of backports from the Gutenberg plugin for WordPress 6.0 Beta 1 release. It includes all updates WordPress packages published to npm based on the Gutenberg plugin v13.0 RC3 release. This patch also includes all the necessary changes applied to core blocks. New blocks included:

  • Avatar
  • Comment Author Name
  • Comment Content
  • Comment Date
  • Comment Edit Link
  • Comment Rely Link
  • Comment Template
  • Comments Pagination
  • Comments Pagination Next
  • Comments Pagination Previous
  • Comments Query Loop
  • Home Link
  • Post Author Biography
  • Query No Results
  • Read More

See more details in https://github.com/WordPress/wordpress-develop/pull/2564.

Props zieladam, ramonopoly, ocean90.
Fixes #55505.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/calendar.php

    r52275 r53157  
    108108}
    109109
    110 /**
    111  * Handler for updating the has published posts flag when a post is deleted.
    112  *
    113  * @param int $post_id Deleted post ID.
    114  */
    115 function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
    116     if ( is_multisite() ) {
    117         return;
     110// We only want to register these functions and actions when
     111// we are on single sites. On multi sites we use `post_count` option.
     112if ( ! is_multisite() ) {
     113    /**
     114     * Handler for updating the has published posts flag when a post is deleted.
     115     *
     116     * @param int $post_id Deleted post ID.
     117     */
     118    function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
     119        $post = get_post( $post_id );
     120
     121        if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
     122            return;
     123        }
     124
     125        block_core_calendar_update_has_published_posts();
    118126    }
    119127
    120     $post = get_post( $post_id );
     128    /**
     129     * Handler for updating the has published posts flag when a post status changes.
     130     *
     131     * @param string  $new_status The status the post is changing to.
     132     * @param string  $old_status The status the post is changing from.
     133     * @param WP_Post $post       Post object.
     134     */
     135    function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {
     136        if ( $new_status === $old_status ) {
     137            return;
     138        }
    121139
    122     if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
    123         return;
     140        if ( 'post' !== get_post_type( $post ) ) {
     141            return;
     142        }
     143
     144        if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
     145            return;
     146        }
     147
     148        block_core_calendar_update_has_published_posts();
    124149    }
    125150
    126     block_core_calendar_update_has_published_posts();
     151    add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
     152    add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 );
    127153}
    128 
    129 /**
    130  * Handler for updating the has published posts flag when a post status changes.
    131  *
    132  * @param string  $new_status The status the post is changing to.
    133  * @param string  $old_status The status the post is changing from.
    134  * @param WP_Post $post       Post object.
    135  */
    136 function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {
    137     if ( is_multisite() ) {
    138         return;
    139     }
    140 
    141     if ( $new_status === $old_status ) {
    142         return;
    143     }
    144 
    145     if ( 'post' !== get_post_type( $post ) ) {
    146         return;
    147     }
    148 
    149     if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
    150         return;
    151     }
    152 
    153     block_core_calendar_update_has_published_posts();
    154 }
    155 
    156 add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
    157 add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 );
Note: See TracChangeset for help on using the changeset viewer.