Hi.
I want to update one meta field value based on category.
My post meta field name is "ae_post_template"
I want to do something like that.
if current post category is "cat1"
update post meta to "1"
if current post category is "cat2"
update post meta to "2"
I am doing with this with an another plugin with this code below:
function wpufe_update_post_price( $post_id ) {
if (has_category('cat1',$post_id))
{
update_post_meta( $post_id, 'ae_post_template', 1 );
}
if (has_category('cat2',$post_id)) {
update_post_meta( $post_id, 'ae_post_template', 2 );
}
}
add_action( 'wpuf_add_post_after_insert', 'wpufe_update_post_price' );
add_action( 'wpuf_edit_post_after_update', 'wpufe_update_post_price' );
I want to do this with backend and also with front end form extension.
With adding new posts and update posts..
Can you help me about this by giving a simple code working with metabox plugin ?,
Thanks