Skip Navigation

[Resolved] custom post

This support ticket is created 4 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 22 replies, has 3 voices.

Last updated by ericV 4 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1908183

Thank you for the update, I have downloaded the site clone and will continue investigating, then give you another update. You may remove the site clone from Dropbox now at your convenience.

#1908203

I have a quick question about this site clone. Normally a clone created with the Duplicator plugin will include a backup of the site database, but it seems this clone was created differently somehow. Did you back up the production database and include it in the archive? I see a SQL file in wp-content/mysql.sql but I'm not sure if that is a current site backup or an older version. If it is a backup of the current live site, I will try to import that database file into my local environment for testing. If it is not a current version, I'll need a backup of the current database.

#1908339

Yes, you're right, this is a complete backup of the website and the database of the production server, not a backup using Duplicator.
Let me know if it is OK, otherwise I will use the duplicator plug-in.

#1908411

I can work with this database dump, thanks for confirming!

#1909859

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Eric,

Christian is currently on holiday today, however he will be back tomorrow to continue assisting with this one.

Thanks,
Shane

#1910697

I've asked my 2nd tier support team to take a closer look at this one. I'm escalating the issue and the site clone so they can continue investigating, and I'll let you know what they find out.

#1920367
query-monitor.png

Hello, my 2nd tier team has performed a few tests and concluded that the problem here lies with the theme since the same issue can be seen if Toolset is not active. You can see and share their comments here with the theme developers:
https://coda.io/d/P2-Replies_dL0rKbi6lvP/P2-5494_suin4#_luXt2

Issue: the category/films/ archive is missing CPT film posts, it only shows standard Posts (if you add the category films to some posts for testing).

After quite extensive debugging I confirmed that it has nothing to do with Toolset, the issue arises because of the theme.

If you add and activate Query Monitor and then load the category/films/ archive you will see there is a single unrelated query from Types (checking the existence of relationship database tables).

see query-monitor.png

Most of the queries on the page are originated by the theme.

We can demonstrate that the problem still occurs without Types.

We need to register the Film CPT using register_post_type, and then we also need to use pre_get_posts to modify the Main Query on the category archives so that they include the film post type (by default they will only return Posts).

Doing that (with Types inactive) we get exactly the same result, namely that the category/films/ archive omits the film posts, while the archives for other terms such as festivals work correctly (try adding the category film to some festivals posts).

I uploaded the theme functions.php edited to include the required code: https://drive.google.com/file/d/1UJlKgWu4ub_NILQqPeRHY5xvPODmFEV9/view?usp=sharing

That file also includes a callback hooked into the posts_results filter, which shows the posts returned by the Main Query on the category archive page.

Try loading the page with or without Types and in both cases you will see (in the debug.log) that the expected posts (including film CPT) are returned by the archive query. Hence if you switch theme to twentytwentyone you’ll see the correct results. But the theme evidently does not use the Main Query results and performs its own queries. That’s where the problem lies, so, over to the theme authors...

#1921567

My issue is resolved now. Thank you!