Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Remove sidebars and footer widgets on 404 page
add_filter( 'generate_sidebar_layout', 'tu_remove_sidebars' );
function tu_remove_sidebars( $sidebar ) {
if ( is_404() ) {
return 'no-sidebar';
}
return $sidebar;
}
add_filter( 'generate_footer_widgets', 'tu_remove_footer_widgets' );
function tu_remove_footer_widgets( $widgets ) {
if ( is_404() ) {
return '0';
}
return $widgets;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment