Closed dbareis closed 1 year ago
This is WordPress core, not Pods related.
WordPress stores the comment_status
param in the database which will override any global post type setting.
Regarding revisions, I'll copy my notes from an other topic:
Did some digging and it appears that WordPress doesn’t hook into wp_update_post or wp_insert_post at all. The only function that includes creating revisions is edit_post: https://developer.wordpress.org/reference/functions/edit_post/
This function only gets triggers when saving the post from the WP admin interface and handles revisions prior to calling wp_update_post.
In short, this issue isn't a bug, and definitely not a Pods related issue. This is simply how WordPress core works. Pods merely sets the post type parameters but upon import or when checking previous data this has no effect.
Look I'm not sure I understand the revision bit above, but just to clarify. If the pod has revisions enabled, if I create a pod object with "$Pod->save($Data, null, $Pod->field('ID'))" and then update it 10 times ("Edit Plant"), there are no revisions, If create my own through the UI then revisions are recorded.
I don't care about the initial creation of the object, but I've read that the supports object needs to specify revisions (I'm not including one as I don't know how, code below). I just need to know for the existing objects how to turn it on?
//--- CREATE A NEW POD --------------------------------------
$Data = array(
'post_status' => 'publish',
'name' => $BotanicalName,
'plant_previous_botanical_names' => $PrevBotanicalName,
'plant_bush_tucker_how_its_used' => $BushTucker,
'plant_size' => $Size,
'plant_foliage' => $Foliage,
'plant_flowers' => $Flowers,
'plant_general_comments' => $GeneralComments,
'plant_common_names' => explode(", ", $CommonName),
'plant_gallery_images' => explode(", ", $GalleryImageIDs),
'plant_further_information' => unserialize($Furtherinformation),
'plant_todo' => $ToDo,
'plant_update_history' => $History,
//--- Any Unknown attributes will be created ---
'light_conditions' => explode(", ", $LightConditions),
'soil_conditions' => explode(", ", $SoilConditions),
'plant_category' => explode(", ", $PlantType),
);
//echo MyDump($Data, 'POD $Data');
if ($ExistingPod)
{
echo '<p>UPDATING EXISTING POD...........</p>';
$NewId = $Pod->save($Data, null, $Pod->field('ID'));
}
else
{
echo '<p>CREATING NEW POD...........</p>';
$PlantObj = pods( 'plant' );
$NewId = $PlantObj->save($Data);
}
echo MyDump($NewId, '$NewId - add()');
Description
I had my plant pod support "comments". I had manually created a few test plants and imported others with PHP code (.save()). These supported comments. I turned off comment support. They still supported comments :-( I deleted my manually created ones and created more "add plant", these correctly didn't support comments.
I had revisions off and again created some manually some imported. Turning this on did not add revision support to the existing plants. After turning it on, new manually created plants supported revisions, but my newly imported plants don't!
Version
2.9.11.1
Testing Instructions
As above
Screenshots / Screencast
Possible Workaround
None for import with PHP. delete manually added plants and recreate.
Site Health Information
Pods Package