Skip to content

Instantly share code, notes, and snippets.

@sybrew
Created June 18, 2025 13:19
Show Gist options
  • Save sybrew/b11079f19a23ca1eac5d58628eca9c92 to your computer and use it in GitHub Desktop.
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.
<?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