Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: add validation to prevent feed names starting with an underscore.
  • Loading branch information
snehapatil2001 committed May 28, 2024
commit cfffd1bf80c2e75aa548bf0cd000ceea3c476a98
6 changes: 6 additions & 0 deletions src/wp-includes/rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ function remove_permastruct( $name ) {
function add_feed( $feedname, $callback ) {
global $wp_rewrite;

// Validate feed name to not start with an underscore.
if ( '_' === substr( $feedname, 0, 1 ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Feed names should not start with an underscore.' ), '6.2.0' );
return false;
}

if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) {
$wp_rewrite->feeds[] = $feedname;
}
Expand Down