[Resolved] View Dropdown not showing all taxonomies
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I watched your video, and it's not obvious why the dropdown isn't including what at face value appear valid Enterprise Brand terms, the set-up appears correct.
Do you have any custom code operating that could affect query results? Try disabling custom code snippets you may have added, or switching theme to make sure there is nothing added to functions.php that could affect this.
To know what terms to include a query to get the posts which match the current settings is run; I wonder if you have some other setting that excludes expected posts from the results which then limits the terms emerging from those posts. For example, if you order the results by a custom field and some posts don't have values for those fields then the posts would be omitted from the results. From your video I can't see what the ordering settings are, but try making sure (to test this) that the View is set to order just by post date.
If none of the above helps I think we'd need access to your site to double-check the settings ourselves. A staging site would be better. And if we can't readily determine the cause, we may need a copy of the site to debug locally.
Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.
Can you also confirm the url of the page with this View?
(Lastly, I note your version of Types doesn't seem up-to-date, but I doubt that is behind this.)
Thank you for sharing the staging website's access details.
I've created a simple classic editor test view and noticed the same behavior on that too.
( it can be seen on a page named "Test view from TS support" )
Looks like some third-party plugin is interfering with the view's built-in queries and to troubleshoot this, I'll recommend testing these views with all extra ( non-Toolset ) plugins disabled and a default theme like Twenty Twenty-One.
If the issue gets fixed, you can start adding the disabled items, by one-by-one to narrow down the possible conflicting ones.
In case the issue still persists, we'll need your permission to download a clone/snapshot of this website to investigate this on a different server, at a deeper database level.
I hope this helps and please let me know how it goes.
I've turned off all the plugins and themes, and unfortunately, the issue persists. You can use the previous login to see my plugin testing (the only two plugins that are active now are Toolset).
What do we need to do to let you investigate the database further?
While performing some further testing and research, I found that this core WordPress bug is responsible for this incorrect count of the taxonomy terms attached to the attachment post type (media library items): https://core.trac.wordpress.org/ticket/22558
While it won't be possible to share an estimate for a fix for this issue, the code snippet from the following forum thread should help in forcing WordPress to update the correct taxonomy term count: https://stackoverflow.com/a/29348686
I hope this helps and please let me know how it goes.
Yes, you'll need to customize that code to cover the taxonomies that are attached to the media library items:
( your website has two taxonomies like these: 'media-category' & 'brand' )
Please remove the code that you've added and instead use:
//Update count callback for taxonomies attached media attachments
function change_media_category_arg() {
global $wp_taxonomies;
if ( taxonomy_exists('media-category') ) {
$wp_taxonomies['media-category']->update_count_callback = '_update_generic_term_count';
}
if ( taxonomy_exists('brand') ) {
$wp_taxonomies['brand']->update_count_callback = '_update_generic_term_count';
}
}
add_action( 'init', 'change_media_category_arg', 9999 );
After adding the code, attached or detach some taxonomy terms from these taxonomies to some media library items. This should force the term count to be updated.