Code Modernization: Use str_ends_with() in a few more places.
`str_ends_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) ends with the given substring (needle). WordPress core includes a polyfill for `str_ends_with()` on PHP < 8.0 as of WordPress 5.9. Follow-up to [55990]. See #58220. Built from https://develop.svn.wordpress.org/trunk@56014 git-svn-id: http://core.svn.wordpress.org/trunk@55526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1907,7 +1907,7 @@ class WP_Rewrite {
|
||||
unset( $this->feed_structure );
|
||||
unset( $this->comment_feed_structure );
|
||||
|
||||
$this->use_trailing_slashes = ( '/' === substr( $this->permalink_structure, -1, 1 ) );
|
||||
$this->use_trailing_slashes = str_ends_with( $this->permalink_structure, '/' );
|
||||
|
||||
// Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
|
||||
if ( preg_match( '/^[^%]*%(?:postname|category|tag|author)%/', $this->permalink_structure ) ) {
|
||||
|
||||
Reference in New Issue
Block a user