WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] After upgrading to 3.5.1 - get_query_var does not work (5 posts)

  1. MCM
    Member
    Posted 1 year ago #

    1. get_query_var is not longer working.

    I had code that checked for a CPT and it no longer works:

    if ( 'my-post-type' === get_query_var('post_type') )

    2. This code also no longer works, which conditional I do not know but I tested this as well are two different env.

    if ( TRUE === $wp_query->is_feed AND 'feed' === $wp_query->query_vars['feed'] AND 'my-post-type' === $wp_query->query_vars['post_type'] ) {

  2. MCM
    Member
    Posted 1 year ago #

    Okay, in the case of #2 I found the

    'my-post-type' === $wp_query->query_vars['post_type']

    is not working correctly.

  3. MCM
    Member
    Posted 1 year ago #

    The other code you gave me also stopped working:

    add_filter( 'post_limits', 'podcast_post_limits_audio' );
    function podcast_post_limits_audio( $limit ) {
    
    	global $wp_query;
    	if ( TRUE === $wp_query->is_feed AND 'feed' === $wp_query->query_vars['feed'] AND 'audio' === $wp_query->query_vars['post_type'] ) {
    		return 'LIMIT 0, 2';
    	}
    	return $limit;
    }

    i.e. 'audio' === $wp_query->query_vars['post_type'] does not work.

    If I omit this then it works 100% i.e. limits to 2 posts but adding it back again it does not work.

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    The other code you gave me also stopped working:

    Who gave you? If it was in one of your other threads, you need to continue there.

  5. MCM
    Member
    Posted 1 year ago #

    No longer applicable.

Topic Closed

This topic has been closed to new replies.

About this Topic