I have a custom post called planner event ,which uses a Divi conotne template
The application seem to keep losing the content template ,
So when i view a record i see just the title but not the template content.
I have goen back in and edited the template via the Divi as i have done many times over the pass year.
If i edit an edit from the admin planner list and update something that fixes it but it comes back to the same issue.
I have checked the settings for the template to make sure it's still using , but still the same problem.
I have 30 users and over 3000 planner events and I am getting more and more support call reference the the issue.
I logged in to your site, and I found one planning event post ("128674 – Quarterly Update – Software Installation") where when viewed on the front end it wasn't displaying the expected content, although it does have the expected content template assigned.
To try and focus in on what the cause might be, it would be helpful to be able to work on a version of the site with all non-Toolset plugins disabled.
Let me set another private reply in case you are able to share credentials of such a staging site.
I noticed that on your website there are 3173 "Planner Events" posts and only 3 of them seem to have the "Planner Events" content template assigned to them.
If you'll go to WP Admin -> Toolset -> Content Templates -> Usage for single page (tab), you'll see a message about the binding of 3170 posts.
( screenshot: hidden link )
Have you used this bulk assignment option before? And do you recall if the template assignment is lost when any specific setting or content is changed?
In case the template's assignment issue reappears after this bulk assignment, we'll need a clone/snapshot of the actual website, where the issue can be reproduced, to investigate these reoccurrences.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )
Please let me know how it goes and I've set your next reply as private.
I have run the update as suggested as this showed abotu 2500 records with the issue.
This has corrected it , but I need to check a littile longoer as it appears to loose the binding.
At 7 am and 8 pm we have a batch an "wp all import" form a csv of the planner events which , deletes the events that have been deleted and updates those that have changed and creates new ones that have been created.
This has been working for least 1 year with not issues, but this may be the problem
I am about to run the binding again and check and i will also check next run which is due to start at 7 am and see if it causes the issue.
I assume that what may be happening is the Planner Event must have a field which is the content template field , that is getting cleared every time we to the import.
add_filter( 'wpv_filter_force_template', 'custom_template_override_pe', 99, 3 );
function custom_template_override_pe( $template_selected, $id, $kind ) {
if ( $kind == 'single-planner-event' ) { // if it's the single planner-event post page
$template_selected = 35839; // force template with this ID
}
return $template_selected;
}
I'm sorry if I couldn't make this point clearer, earlier.
The code that I shared won't be affected by the import process, because it doesn't rely on whether the "Planner Event Content Template" is assigned to a particular "planner-event" post or not.
Even when you'll see that at the WP Admin -> Toolset -> Content Templates -> Usage for single page (tab), that some of the "planner-event" posts are not binding with the "Planner Event Content Template", the code will ensure that whenever "Any" single "planner-event" page is shown, it uses that "Planner Event Content Template".