Skip Navigation

[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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 9 replies, has 3 voices.

Last updated by glennN 1 year, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2541101

I am trying to:
Get all the Brand Taxomonies to show in the drop-down.

I've made a video about it:
hidden link

#2541765

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

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.)

#2542419

Error

#2542613

Hi Mike,

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.

regards,
Waqar

#2543989

Hi Waqar, thanks for making the test view.

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?

Cheers,
Mike

#2544729

Hi Waqar, is that anything I can do to help with the database review?

I'm working to a deadline for my client.

Cheers,

#2544971

Thank you for waiting.

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.

#2545353

Hi Waqar, thanks for confirming for me.

I tried the Stack code but it didn't work - do I need to customise the code to my particular taxonomy?

function my_add_categories_to_attachments() {
$myTaxonomy = get_taxonomies(array('name' => 'category'), 'objects')['category'];
$myTaxonomy->update_count_callback = '_update_generic_term_count';
register_taxonomy ('category',
$myTaxonomy->object_type,
array_merge ((array) $myTaxonomy,
array('capabilities' => (array) $myTaxonomy->cap)));

register_taxonomy_for_object_type( 'category', 'attachment' );
}
add_action( 'init' , 'my_add_categories_to_attachments' );

Thanks,

#2546219

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.

#2546855

My issue is resolved now. Thank you!