How to make functions and filters dynamic for all the custom fields
-
Hi,
This plugin works grate!!
We want to know how can we make functions and filters dynamic for all the custom fields.
We added this code for a single custom field revision.
//State that wp-post-meta-revisions should save our field
function add_meta_keys_to_revision( $keys ) {
$keys[] = ‘test’;
return $keys;
}
add_filter( ‘wp_post_revision_meta_keys’, ‘add_meta_keys_to_revision’ );//Define the field on the revisions screen
function extrev_custom_fields($fields)
{
$fields[‘test’] = ‘Revision meta value’;
return $fields;
}
add_filter(‘_wp_post_revision_fields’,’extrev_custom_fields’);//For some reason (havent looked into it) the value is in a array, just pick it out
function extrev_field( $value, $field ) {$test = $value[0];
return $test;
}
add_filter( ‘_wp_post_revision_field_test’, ‘extrev_field’, 10, 2 );Please let us know if we can do something to make it dynamic for all other fields.
Thanks!
Shweta
- The topic ‘How to make functions and filters dynamic for all the custom fields’ is closed to new replies.