• Resolved viter-z-bayraku

    (@viter-z-bayraku)


    I have select filter in custom post type write panel.
    Post filtered by custom field edate_m:

    add_filter( 'parse_query', 'sort_calendar_by_date' );
    function sort_calendar_by_date($query) {
        global $pagenow;
    
    if(is_admin() && $pagenow=='edit.php' && isset($_GET['post_type']) && isset($_GET['post_type'])=='calendar' && $_GET['sortby_d'] =='0' && $_GET['sortby_m'] !='0'){
    	        $query->query_vars['meta_key'] = 'edate_m';
    		$query->query_vars['meta_value'] = $_GET['sortby_m'];
    	}
    }

    All working perfect. But if I pressing to page 2, filter are resseting and variable &sortby_m=1 in address line in dissapearing.

    How I can implement custom fields filter variable to pagination? Thank you!

Viewing 1 replies (of 1 total)
  • Thread Starter viter-z-bayraku

    (@viter-z-bayraku)

    Sorry! Please delete this topic. I fixed this issue. My code was wrong.
    I deleted line “&& $_GET[‘sortby_d’] ==’0′” and now all working..

Viewing 1 replies (of 1 total)
  • The topic ‘How add custom filter to admin custom post type pagination?’ is closed to new replies.