call a function when insert and update a custom post type

This is the original answer but it is little faulty, look below for the updated You can use following approach. The my_action_updated_post_meta is executed after the post insert or update is done: // define the updated_post_meta callback function my_action_updated_post_meta( $array, $int, $int ) { global $post; // see your updated post print_r($post); // make your … Read more

Unwanted URL with Custom Post Type

function rt_custom_post() { register_post_type( ‘book’, array( ‘labels’ => array( ‘name’ => __( ‘Books’ ), ‘singular_name’ => __( ‘Book’ ), ), ‘public’ => true, ‘has_archive’ => false, //this will eliminate the archive page ‘supports’ => array(‘title’,’editor’,’thumbnail’), ‘publicly_queryable’ => true ) ); if you add : ‘has_archive’ => false, to your register post type, it will remove … Read more

Exclude Posts in a Given Category

Check if the array contains a category not tested live but is valid PHP <?php $myquery[‘tax_query’] = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘category__not_in’ => array(‘explore’), ‘field’ => ‘slug’, ), array( ‘taxonomy’ => ‘category’, ‘terms’ => array(‘outdoor-recreation’), ‘field’ => ‘slug’, ), array( ‘taxonomy’ => ‘take_category’, ‘terms’ => array(‘outdoor-recreation’), ‘field’ => ‘slug’, ), array( … Read more