Thanks for the info. I was able to test it.
For the plugin author: When series_toc_url
is parsed, it is done by altering WP_Query
, which causes unexpected behavior. Adding custom parameters to it also requires all other plugins to consider your changes.
To clarify, currently, on the series TOC page, this is what the WordPress Query API tells us, even after your careful adjustments:
- Post Type: post
- Query Type: N/A (not singular, not archive)
- ID: 0 (non-existing)
- Paged: Value of blog page.
You may wish to look at how WooCommerce resolved this issue for the /shop/
page:
- They allow you to select a
page
post ID — stored at woocommerce_shop_page_id
.
- If that page is set, the user has some control of that page’s structure and full control of the metadata; the plugin can output the template via filter
the_content
.
- If that page doesn’t exist, it’ll fall back to a Post Type Archive registered at
WC_Post_Types::register_post_types()
.
This would alleviate the need to filter the title, content, excerpt, scripts, posts_where, etc., saving you a lot of time spent on maintenance. Because then, WordPress can take care of it, and all other plugins can understand what is going on without needing to add bespoke support for your plugin.
I would skip the fallback to an actual PTA (point 3) because you do not “own” the post
-post type.
I understand that making changes may be unfavorable for a host of reasons. But please consider my suggestions.
Until then, to work around this, @tbronson, you can use the following filter.
It will work as expected on TSF v5.0 (ETA next week) because I also needed to make some adjustments:
add_filter( 'the_seo_framework_query_supports_seo', function( $supported ) {
// No need to modify support if it's already not supported.
if ( ! $supported ) return $supported;
// The current query is supported when 'is_seriestoc' isn't 'true'.
return empty( $GLOBALS['wp_query']->is_seriestoc );
} );
I hope this helps. Cheers!