public static function parse_query($posts_query) { // Bail if $posts_query is not the main loop if (!$posts_query->is_main_query()) { return; } // Bail if filters are suppressed on this query if (true === $posts_query->get('suppress_filters')) { return; } // Bail if in admin if (is_admin()) { return; } // Get query variables $is_write = $posts_query->get(bbp_get_write_rewrite_id()); // Write? if (!empty($is_write)) { // Get the post type from the main query loop $post_type = $posts_query->get('post_type'); // Check which post_type we are editing, if any if (!empty($post_type)) { switch ($post_type) { // We are editing a forum case bbp_get_forum_post_type(): $posts_query->bbp_is_topic_write = true; $posts_query->bbp_is_write = true; break; } } } }
public static function add_rewrite_tags() { add_rewrite_tag('%' . bbp_get_write_rewrite_id() . '%', '([1]{1,})'); // Edit Page tag }