/** * unset_post_shortcodes_on_delete * * @access protected * @param int $ID * @param $shortcode_class * @param $shortcode_posts * @param $page_for_posts * @param bool $update_post_shortcodes * @return bool */ protected static function unset_posts_page_shortcode_for_post($ID, $shortcode_class, $shortcode_posts, $page_for_posts, $update_post_shortcodes = false) { // make sure that an array of post IDs is being tracked for each shortcode if (!is_array($shortcode_posts)) { \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class] = array($shortcode_posts => true); $update_post_shortcodes = true; } // now if the ID of the post being deleted is in the $shortcode_posts array if (is_array($shortcode_posts) && isset($shortcode_posts[$ID])) { unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class][$ID]); $update_post_shortcodes = true; } // if nothing is registered for that shortcode anymore, then delete the shortcode altogether if (empty(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])) { unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class]); $update_post_shortcodes = true; } return $update_post_shortcodes; }