-
Notifications
You must be signed in to change notification settings - Fork 9
Piotr Pelczar edited this page Apr 23, 2018
·
4 revisions
In case of missing custom post field values you can generate them on-the-fly using generate_dynamic_metadata
filter.
Example:
function generate_dynamic_metadata( $post_meta = null, $post = null ) {
if ( ! array_key_exists( 'some_meta_key', $post_meta ) ) {
$post_meta['some_meta_key'] = 'Default value';
}
return $post_meta;
}
add_filter( 'wpcfp_get_post_metadata', array( $this, 'generate_dynamic_metadata' ), 1, 2 );