Skip Navigation

[Resolved] Toolset making DUPLICATE 'custom post types' in database table

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

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 1 reply, has 2 voices.

Last updated by Waqar 2 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#2511737
Screen_Shot_2022-12-08_at_06_56_47.png

I am trying to: get a list of the custom post types on my website

Link to a page where the issue can be seen: see screenshot - i added some colors to show duplicates.

I expected to see: a list of unique CPTs

Instead, I got: duplicates galore.

Why is this happening? how do i fix it? how do i prevent it in the future?

thanks

#2512363

Hi,

Thank you for contacting us and I'd be happy to assist.

From the screenshot, it seems that you're using the table "{table_prefix}toolset_type_sets" to get the list of custom post types registered on the website, which is not correct.

That table is used by the Toolset's post-relationship feature to store information about the post types which are participants in any relationship.
( which is why you'll see some post types with multiple entries and some not even once )

To get the list of custom post types registered on the website, you can use a WordPress function like 'get_post_types':
https://developer.wordpress.org/reference/functions/get_post_types/

regards,
Waqar