function yarpp_save_cache($post_ID, $force = true) { global $wpdb; $sql = "select post_parent, post_type from {$wpdb->posts} where ID='{$post_ID}'"; $parent_ID = $wpdb->get_var($sql, 0); if ($parent_ID != $post_ID and $parent_ID) { $post_ID = $parent_ID; } $post_type = $wpdb->get_var($sql, 1); if (yarpp_get_option('cross_relate')) { $type = array('post', 'page'); } elseif ($post_type == 'page') { $type = array('page'); } else { $type = array('post'); } // TODO: support other post types? maybe? // TODO: fix this bug... we should be getting the post type from the parent, if there is one. yarpp_cache_enforce($type, $post_ID, $force); }
function yarpp_save_cache($post_ID, $force = true) { global $wpdb; // new in 3.2: don't compute cache during import if (defined('WP_IMPORTING')) { return; } $sql = "select post_parent from {$wpdb->posts} where ID='{$post_ID}'"; $parent_ID = $wpdb->get_var($sql); if ($parent_ID != $post_ID and $parent_ID) { $post_ID = $parent_ID; } yarpp_cache_enforce($post_ID, $force); }
function yarpp_save_cache($post_ID, $force = true) { global $wpdb; $parent_ID = $wpdb->get_var("select post_parent from {$wpdb->posts} where ID='{$post_ID}'"); if ($parent_ID != $post_ID and $parent_ID) { $post_ID = $parent_ID; } if (yarpp_get_option('cross_relate')) { $type = array('post', 'page'); } else { $type = array('post'); } yarpp_cache_enforce($type, $post_ID, $force); }