diff --git a/wp-includes/class-wp-block-pattern-categories-registry.php b/wp-includes/class-wp-block-pattern-categories-registry.php index 90a69f003e..82cb80ce28 100644 --- a/wp-includes/class-wp-block-pattern-categories-registry.php +++ b/wp-includes/class-wp-block-pattern-categories-registry.php @@ -38,7 +38,11 @@ final class WP_Block_Pattern_Categories_Registry { */ public function register( $category_name, $category_properties ) { if ( ! isset( $category_name ) || ! is_string( $category_name ) ) { - _doing_it_wrong( __METHOD__, __( 'Block pattern category name must be a string.' ), '5.5.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Block pattern category name must be a string.' ), + '5.5.0' + ); return false; } @@ -60,9 +64,12 @@ final class WP_Block_Pattern_Categories_Registry { */ public function unregister( $category_name ) { if ( ! $this->is_registered( $category_name ) ) { - /* translators: %s: Block pattern name. */ - $message = sprintf( __( 'Block pattern category "%s" not found.' ), $category_name ); - _doing_it_wrong( __METHOD__, $message, '5.5.0' ); + _doing_it_wrong( + __METHOD__, + /* translators: %s: Block pattern name. */ + sprintf( __( 'Block pattern category "%s" not found.' ), $category_name ), + '5.5.0' + ); return false; } diff --git a/wp-includes/class-wp-block-patterns-registry.php b/wp-includes/class-wp-block-patterns-registry.php index 7963440814..7496b445c2 100644 --- a/wp-includes/class-wp-block-patterns-registry.php +++ b/wp-includes/class-wp-block-patterns-registry.php @@ -41,17 +41,29 @@ final class WP_Block_Patterns_Registry { */ public function register( $pattern_name, $pattern_properties ) { if ( ! isset( $pattern_name ) || ! is_string( $pattern_name ) ) { - _doing_it_wrong( __METHOD__, __( 'Pattern name must be a string.' ), '5.5.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Pattern name must be a string.' ), + '5.5.0' + ); return false; } if ( ! isset( $pattern_properties['title'] ) || ! is_string( $pattern_properties['title'] ) ) { - _doing_it_wrong( __METHOD__, __( 'Pattern title must be a string.' ), '5.5.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Pattern title must be a string.' ), + '5.5.0' + ); return false; } if ( ! isset( $pattern_properties['content'] ) || ! is_string( $pattern_properties['content'] ) ) { - _doing_it_wrong( __METHOD__, __( 'Pattern content must be a string.' ), '5.5.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Pattern content must be a string.' ), + '5.5.0' + ); return false; } @@ -73,9 +85,12 @@ final class WP_Block_Patterns_Registry { */ public function unregister( $pattern_name ) { if ( ! $this->is_registered( $pattern_name ) ) { - /* translators: %s: Pattern name. */ - $message = sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ); - _doing_it_wrong( __METHOD__, $message, '5.5.0' ); + _doing_it_wrong( + __METHOD__, + /* translators: %s: Pattern name. */ + sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ), + '5.5.0' + ); return false; } diff --git a/wp-includes/class-wp-block-styles-registry.php b/wp-includes/class-wp-block-styles-registry.php index e95f7bf361..0d419da12e 100644 --- a/wp-includes/class-wp-block-styles-registry.php +++ b/wp-includes/class-wp-block-styles-registry.php @@ -43,14 +43,20 @@ final class WP_Block_Styles_Registry { public function register( $block_name, $style_properties ) { if ( ! isset( $block_name ) || ! is_string( $block_name ) ) { - $message = __( 'Block name must be a string.' ); - _doing_it_wrong( __METHOD__, $message, '5.3.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Block name must be a string.' ), + '5.3.0' + ); return false; } if ( ! isset( $style_properties['name'] ) || ! is_string( $style_properties['name'] ) ) { - $message = __( 'Block style name must be a string.' ); - _doing_it_wrong( __METHOD__, $message, '5.3.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Block style name must be a string.' ), + '5.3.0' + ); return false; } @@ -73,9 +79,12 @@ final class WP_Block_Styles_Registry { */ public function unregister( $block_name, $block_style_name ) { if ( ! $this->is_registered( $block_name, $block_style_name ) ) { - /* translators: 1: Block name, 2: Block style name. */ - $message = sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ); - _doing_it_wrong( __METHOD__, $message, '5.3.0' ); + _doing_it_wrong( + __METHOD__, + /* translators: 1: Block name, 2: Block style name. */ + sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ), + '5.3.0' + ); return false; } diff --git a/wp-includes/class-wp-block-type-registry.php b/wp-includes/class-wp-block-type-registry.php index e4a7fc9a75..c9a5776c55 100644 --- a/wp-includes/class-wp-block-type-registry.php +++ b/wp-includes/class-wp-block-type-registry.php @@ -52,28 +52,40 @@ final class WP_Block_Type_Registry { } if ( ! is_string( $name ) ) { - $message = __( 'Block type names must be strings.' ); - _doing_it_wrong( __METHOD__, $message, '5.0.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Block type names must be strings.' ), + '5.0.0' + ); return false; } if ( preg_match( '/[A-Z]+/', $name ) ) { - $message = __( 'Block type names must not contain uppercase characters.' ); - _doing_it_wrong( __METHOD__, $message, '5.0.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Block type names must not contain uppercase characters.' ), + '5.0.0' + ); return false; } $name_matcher = '/^[a-z0-9-]+\/[a-z0-9-]+$/'; if ( ! preg_match( $name_matcher, $name ) ) { - $message = __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ); - _doing_it_wrong( __METHOD__, $message, '5.0.0' ); + _doing_it_wrong( + __METHOD__, + __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ), + '5.0.0' + ); return false; } if ( $this->is_registered( $name ) ) { - /* translators: %s: Block name. */ - $message = sprintf( __( 'Block type "%s" is already registered.' ), $name ); - _doing_it_wrong( __METHOD__, $message, '5.0.0' ); + _doing_it_wrong( + __METHOD__, + /* translators: %s: Block name. */ + sprintf( __( 'Block type "%s" is already registered.' ), $name ), + '5.0.0' + ); return false; } @@ -101,9 +113,12 @@ final class WP_Block_Type_Registry { } if ( ! $this->is_registered( $name ) ) { - /* translators: %s: Block name. */ - $message = sprintf( __( 'Block type "%s" is not registered.' ), $name ); - _doing_it_wrong( __METHOD__, $message, '5.0.0' ); + _doing_it_wrong( + __METHOD__, + /* translators: %s: Block name. */ + sprintf( __( 'Block type "%s" is not registered.' ), $name ), + '5.0.0' + ); return false; } diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index af0efb1a62..63d5dc41ff 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -3907,18 +3907,20 @@ final class WP_Customize_Manager { public function remove_panel( $id ) { // Removing core components this way is _doing_it_wrong(). if ( in_array( $id, $this->components, true ) ) { - $message = sprintf( - /* translators: 1: Panel ID, 2: Link to 'customize_loaded_components' filter reference. */ - __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ), - $id, + _doing_it_wrong( + __METHOD__, sprintf( - '%2$s', - esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ), - 'customize_loaded_components' - ) + /* translators: 1: Panel ID, 2: Link to 'customize_loaded_components' filter reference. */ + __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ), + $id, + sprintf( + '%2$s', + esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ), + 'customize_loaded_components' + ) + ), + '4.5.0' ); - - _doing_it_wrong( __METHOD__, $message, '4.5.0' ); } unset( $this->panels[ $id ] ); } diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index abe87a10bb..abe930758d 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -304,13 +304,16 @@ function wp_deregister_script( $handle ) { ); if ( in_array( $handle, $not_allowed, true ) ) { - $message = sprintf( - /* translators: 1: Script name, 2: wp_enqueue_scripts */ - __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ), - "$handle", - 'wp_enqueue_scripts' + _doing_it_wrong( + __FUNCTION__, + sprintf( + /* translators: 1: Script name, 2: wp_enqueue_scripts */ + __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ), + "$handle", + 'wp_enqueue_scripts' + ), + '3.6.0' ); - _doing_it_wrong( __FUNCTION__, $message, '3.6.0' ); return; } } diff --git a/wp-includes/query.php b/wp-includes/query.php index c1565d4425..b915119c35 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -899,19 +899,23 @@ function is_embed() { * @return bool Whether the query is the main query. */ function is_main_query() { + global $wp_query; + if ( 'pre_get_posts' === current_filter() ) { - $message = sprintf( - /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */ - __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ), - 'pre_get_posts', - 'WP_Query->is_main_query()', - 'is_main_query()', - __( 'https://developer.wordpress.org/reference/functions/is_main_query/' ) + _doing_it_wrong( + __FUNCTION__, + sprintf( + /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */ + __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ), + 'pre_get_posts', + 'WP_Query->is_main_query()', + 'is_main_query()', + __( 'https://developer.wordpress.org/reference/functions/is_main_query/' ) + ), + '3.7.0' ); - _doing_it_wrong( __FUNCTION__, $message, '3.7.0' ); } - global $wp_query; return $wp_query->is_main_query(); } diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index 62d1d1e644..0d9fdc8148 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -64,15 +64,25 @@ function add_shortcode( $tag, $callback ) { global $shortcode_tags; if ( '' === trim( $tag ) ) { - $message = __( 'Invalid shortcode name: Empty name given.' ); - _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); + _doing_it_wrong( + __FUNCTION__, + __( 'Invalid shortcode name: Empty name given.' ), + '4.4.0' + ); return; } if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) { - /* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */ - $message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' ); - _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); + _doing_it_wrong( + __FUNCTION__, + sprintf( + /* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */ + __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), + $tag, + '& / < > [ ] =' + ), + '4.4.0' + ); return; } @@ -314,9 +324,12 @@ function do_shortcode_tag( $m ) { $attr = shortcode_parse_atts( $m[3] ); if ( ! is_callable( $shortcode_tags[ $tag ] ) ) { - /* translators: %s: Shortcode tag. */ - $message = sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ); - _doing_it_wrong( __FUNCTION__, $message, '4.3.0' ); + _doing_it_wrong( + __FUNCTION__, + /* translators: %s: Shortcode tag. */ + sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ), + '4.3.0' + ); return $m[0]; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 056c1d876a..556df2098b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-beta1-51153'; +$wp_version = '5.8-beta1-51154'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.