Created
June 18, 2025 13:19
-
-
Save sybrew/b11079f19a23ca1eac5d58628eca9c92 to your computer and use it in GitHub Desktop.
This code snippet modifies The SEO Framework plugin to let search engines index empty category archives by disabling the noindex directive. Note: WordPress may still emit a 404 response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do not open PHP if PHP is already opened. | |
add_filter( | |
'the_seo_framework_enable_noindex_no_posts', | |
function ( $noindex ) { | |
if ( is_category() ) { | |
// To allow indexing, so set noindex to false. | |
$noindex = false; | |
} | |
return $noindex; | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment