Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion includes/Optimizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function get_options() {
'self_ping' => true,
'comments' => false,
'jquery_migrate' => true,
'clean_nav_menu' => true,
'clean_nav_menu' => false,
'rss_feed' => false,
'xmlrpc' => true,
],
Expand Down
6 changes: 4 additions & 2 deletions includes/Optimizations/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,17 @@
*/
public function clean_nav_menu() {
add_filter( 'nav_menu_css_class', function ( $classes ) {
if ( ! is_array( $classes ) ) {
return $classes;
}

return array_intersect( $classes, [
'current-menu-item',
'menu-item-has-children',
'menu-item',
'current-menu-ancestor',
] );
} );

add_filter( 'nav_menu_item_id', '__return_null' );
}

/**
Expand All @@ -138,7 +140,7 @@
public function remove_rss_feed() {
add_action( 'template_redirect', function () {
if ( is_feed() ) {
wp_redirect( home_url(), 301 );

Check warning on line 143 in includes/Optimizations/General.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

wp_redirect() found. Using wp_safe_redirect(), along with the allowed_redirect_hosts filter if needed, can help avoid any chances of malicious redirects within code. It is also important to remember to call exit() after a redirect so that no other unwanted code is executed.
exit;
}
}, 1 );
Expand Down
Loading