/** * admin_init * * @access public * @return void */ public function admin_init() { /** * our cpt models must be instantiated on WordPress post processing routes (wp-admin/post.php), * so any hooking into core WP routes is taken care of. So in this next few lines of code: * - check if doing post processing. * - check if doing post processing of one of EE CPTs * - instantiate the corresponding EE CPT model for the post_type being processed. */ if (isset($_POST['action']) && $_POST['action'] == 'editpost') { if (isset($_POST['post_type'])) { EE_Registry::instance()->load_core('Register_CPTs'); EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); } } /** * This code is for removing any set EE critical pages from the "Static Page" option dropdowns on the * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. */ global $pagenow; if ($pagenow == 'options-reading.php') { add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); } }
/** * admin_init * * @access public * @return void */ public function admin_init() { /** * our cpt models must be instantiated on WordPress post processing routes (wp-admin/post.php), * so any hooking into core WP routes is taken care of. So in this next few lines of code: * - check if doing post processing. * - check if doing post processing of one of EE CPTs * - instantiate the corresponding EE CPT model for the post_type being processed. */ if (isset($_POST['action']) && $_POST['action'] == 'editpost') { if (isset($_POST['post_type'])) { EE_Registry::instance()->load_core('Register_CPTs'); EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); } } }