Skip to content

Commit 3a0f401

Browse files
Code Modernization: Use str_contains() in get_shortcode_tags_in_content().
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle). WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9. Follow-up to [52039], [55988], [56245], [56838], [60900]. See #63168. git-svn-id: https://develop.svn.wordpress.org/trunk@60901 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8316c7d commit 3a0f401

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/shortcodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function has_shortcode( $content, $tag ) {
182182
* @return string[] An array of registered shortcode names found in the content.
183183
*/
184184
function get_shortcode_tags_in_content( $content ) {
185-
if ( false === strpos( $content, '[' ) ) {
185+
if ( ! str_contains( $content, '[' ) ) {
186186
return array();
187187
}
188188

0 commit comments

Comments
 (0)