Support

Account

Forum Replies Created

  • Scott Clark has posted a potential solution for this that also applies to Pods and Gravity Forms: https://github.com/sc0ttkclark/wp-post-locking

  • I got this to work using your solution, but when clicking back to another tab or showing different maps on multiple tabs they immediately revert back to being beige / grey boxes. Any thoughts?

  • I’ve been working with this same code, but to filter “Coupons” by “Service Type”, where service_type is a custom post type that is part of each coupon in the form of a relationship field. The one thing that i did that made this work is to add:

    $query->query_vars['meta_compare'] = 'LIKE';

    in the wpse45436_posts_filter function so it should read like this:

    function wpse45436_posts_filter( $query ){
        global $pagenow;
        $type = 'post';
        if (isset($_GET['post_type'])) {
            $type = $_GET['post_type'];
        }
        if ( 'sp_people' == $type && is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_FILTER_FIELD_VALUE']) && $_GET['ADMIN_FILTER_FIELD_VALUE'] != '') {
            $query->query_vars['meta_key']     = 'sp_people_status';
            $query->query_vars['meta_value']   = $_GET['ADMIN_FILTER_FIELD_VALUE'];
            $query->query_vars['meta_compare'] = 'LIKE';
        }
    }

    Hope this works for you.

  • Thank you John, this solved my problem. I’m posting the updated code here for others to see. What i did is make the feature part of my meta_query and declare an index for “feature_clause” that just checks to see if the field exists. Then i added that to the “orderby” array including “date”, so both are sorted together. Here’s the updated query:

    $review_args = array ( 
    	'post_type' => 'customer_reviews',
    	'posts_per_page' => 20,
    	'post_status' => 'publish',
    
    	'meta_query' => array( 
    		'relation' => 'AND',
    		'feature_clause' => array(
    			'key' => 'featured',
    			'compare' => 'EXISTS',
    		),
    	),
    
    	'orderby' => array(
    		'featured' => 'DESC',
    		'date' => 'DESC',
    	),
    
    	'fields' => 'ids' 
    );
Viewing 4 posts - 1 through 4 (of 4 total)