Tagged: revisions
- This topic has 8 replies, 2 voices, and was last updated 6 years, 1 month ago by
Steve.
-
AuthorPosts
-
-
November 11, 2015 at 1:04 am #4919
conkidMemberHello,
Looking for help from the community on this one. Adam Silverstein has put out a wordpress plugin: https://wordpress.org/plugins/wp-post-meta-revisions/
It’s called wp-post-meta-revisions and it saves post meta revisions by adding custom meta field names to a simple array. From what I can tell it is being developed to be implemented into core long-term.
I’ve got a field in my custom post type ‘assets’ labeled ‘asset_type’. I implement the following code:
/*Save Custom Meta for Revisions*/function add_meta_keys_to_revision( $keys ) {
$keys[] = ‘asset_type’;
return $keys;
}
add_filter( ‘wp_post_revision_meta_keys’, ‘add_meta_keys_to_revision’ );When I look in the database I can see the entries being made successfully:
176 _wp_post_revision_meta_keys a:2:{i:0;s:10:”asset_type”;i:1;s:10:”model_type”;}When I use built in revision viewer I only see the title. Not sure if this is by design or not? I love piklist but without a method to save revisions I’m going to have trouble bringing into my workflow.
FYI I’m working on an converting an intranet theme I’ve built with advanced custom fields and several other plugins to piklist.
-
December 28, 2015 at 5:49 pm #5425
SteveKeymasterThis is working in our latest beta.
Just remember When you register your post type, you need to specify that it supports revisions. Use the “supports” parameter.
-
December 28, 2015 at 10:35 pm #5427
conkidMemberSteve – I can confirm revisions are now working properly.
A couple of things to comment…
When the revisions are stored the values returned from the viewer show the ID of custom taxonomy rather than the string. You can see in my screenshot how it isn’t really easy to decipher the meaning from the ID. Wondering if this is by design?
Secondly, having issues with the admin columns displaying properly with — ‘show_admin_column’ => true — the columns show but the data does not display.
Attachments:
You must be logged in to view attached files. -
December 28, 2015 at 10:44 pm #5430
SteveKeymaster@conkid– Term ID’s are how WordPress saves it’s data. Everything in WordPress is saved with ID’s.
Term data is showing up for me in the demos, which is set to show_admin_column to true. Feel free to email your code to [email protected] and we’ll take a look.
-
December 28, 2015 at 11:15 pm #5431
conkidMemberIs there a way to convert the term id to the term so the data is readable?
-
December 28, 2015 at 11:19 pm #5432
-
December 28, 2015 at 11:52 pm #5433
conkidMemberIn the revisions page
-
December 29, 2015 at 5:54 pm #5443
SteveKeymaster@conkid– WordPress saves term data by ID, not slug or name. So if you want it saved, that can’t change. This a limit on WordPress, not Piklist. You can create another field, that pulls the term ID’s, converts them to slug or name, and save that. It may be a little tricky to implement.
-
December 30, 2015 at 11:13 am #5463
SteveKeymaster@conkid– I just emailed you back your code. The reason the taxonomy data wasn’t showing on the list table, is because you weren’t really saving the taxonomy data as taxonomy data… you were saving it as post_meta.
When using a taxonomy field on any page except editing terms (i.e. editing a post), you need to do two things:
1) The field name must be the exact name of the taxonomy.
2) You must set ‘scope’ => ‘taxonomy’Hope this helps.
-
-
AuthorPosts
- You must be logged in to reply to this topic.