error in Advanced Search Form for Custom Post Types in WordPress array_key_exists() expects parameter 2to be array, string given

The core issue is that you’re having trouble creating a filtered search. Why not use a pre_get_posts hook to modify the query before it actually gets called, then you don’t need to modify the template files at all: /** * Modify WP_Query before it asks the database what data to retrieve * Belongs in functions.php … Read more

How do I provide a “show all posts” link in a paginated term archive?

This method will set it up so that if you add /all to the end of your taxonomy archives, it will show all posts. First, when registering the taxonomy, make sure you set the ep_mask to EP_CATEGORIES. This means we can add a custom endpoint to it. function wpse_277843_register_taxonomy() { register_taxonomy( ‘game_go_series’, ‘game_go’, array( ‘rewrite’ … Read more

Custom Post Type rewrite rules not working, how to alter the rewrite order?

While you’ve found the problem already, here is some basic code to move a specific rule to the end of the rewrite rules with the rewrite_rules_array filter for people stumbling across a similar problem. Say I want to move the rule for ([^/]*)/([^/]*)/?$: add_filter(“rewrite_rules_array”, function($rules) { $keys = array_keys($rules); foreach($keys as $rule) { if($rule == … Read more

Using a Custom Post Type Attachment as link

you don’t want the link to the actual post then use the field link again: <?php $args = array( ‘numberposts’ => ‘5’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘include’ => ”, ‘exclude’ => ”, ‘meta_key’ => ”, ‘meta_value’ =>”, ‘post_type’ => ‘weekly_mktg_report’, ‘post_status’ => ‘publish’ ); $recent_posts = wp_get_recent_posts( $args ); echo ‘<ul>’; //i was … Read more