Untitled
unknown
plain_text
22 days ago
853 B
1
Indexable
Never
add_action('save_post', 'b2bking_save_groups_metaboxes', 10, 1); function b2bking_save_groups_metaboxes($post_id){ if (isset($_POST['_inline_edit'])){ return; } if (isset($_REQUEST['bulk_edit'])){ return; } $postobj = get_post($post_id); if ( $postobj->post_status === 'trash' ) { return; } if (isset($_GET['action'])) { if ($_GET['action'] === 'untrash'){ return; } } $p = get_post($post_id); if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || ($p->post_status === 'auto-draft')) { return; } if (get_post_type($post_id) === 'b2bking_group'){ $allposts= get_posts( array('post_type'=> 'page','numberposts'=>-1) ); foreach ($allposts as $eachpost) { $page_id = $eachpost->ID; update_post_meta($page_id,'b2bking_group_'.$post_id, 0); } } }
Leave a Comment