I am using publish_{custom-post-type} hook to update meta of the post that has just been published. The post-type is jobboard-post-jobs. Why isn't it working?

add_action('publish_jobboard-post-jobs', 'when_new_job_published');
function when_new_job_published( $post_id, $post ) {
    update_post_meta( $post_id, 'meta_key_name', 'updated text for meta value' );

what am I missing here?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.