WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Bug report: bad code in lib/query (6 posts)

  1. Frumph
    Member
    Posted 2 months ago #

    file: lib/tribe-event-query.class.php

    Bad code:

    // include events in search results
    			if ( $query->is_search && $query->get( 'post_type' ) == '' ) {
    				$query->set( 'post_type', 'any' );
    			}

    the $query->set 'any' is not applicable in all instances where post_type == '' especially when other things are adding to it which results in regular 'post' post type is not being found, commenting out this code makes them work again for everyone else...

    Using this in the register_taxonomy *should* be all you need instead of that.
    'query_var' => true

    https://wordpress.org/plugins/the-events-calendar/

  2. Brook
    Modern Tribe Support Rep
    Plugin Author

    Posted 2 months ago #

    Howdy Frumph,

    Thank you for taking the time to document this! I will pass it along to our devs and they can review implementing it.

    While I can not speak to these three lines, I know that we have found plenty of times where doing all you "should" need to do means that you end up conflicting with some major themes or plugins. So, we have to find work arounds. It is possible that this code is just such a work around.

    Thanks again, we really appreciate assistance in polishing off The Events Calendar.

    - Brook

  3. Brook
    Modern Tribe Support Rep
    Plugin Author

    Posted 2 months ago #

    Hello again Frumph,

    We have looked into this a bit further. We definitely feel like setting the post_type to any is not a perfect solution, and are interested in changing that to be more specific. However, your proposed solution will unfortunately not work for the variety of environments and situations our plugin is used in.

    Would you mind letting us know what specific problem are you facing? Do you have other custom post_types that you wanted excluded from search results? Is that how you discovered this bug? If we have specifics then we can better understand if our solution is going to work for people in your circumstance. And if anyone else comes across this and has found it to be a difficulty, please chime in about what your are trying to do and why this affects it. Thanks!

    - Brook

  4. Frumph
    Member
    Posted 2 months ago #

    The way you should do it, is get the the array of post_type and ADD yours to it, not replace it - don't set it to 'any'; putting any nulls out any other and all other custom post types that are associated

    The problem is that when something is '' it really isn't '' it's reading off the base of possible post types to search from from internal values; changing that negates those

  5. Brook
    Modern Tribe Support Rep
    Plugin Author

    Posted 2 months ago #

    > The way you should do it, is get the the array of post_type and ADD yours to it, not replace it - don't set it to 'any'; putting any nulls out any other and all other custom post types that are associated

    Agreed 100%. That is what we are looking into doing. I appreciate your feedback.

    > The problem is that when something is '' it really isn't '' it's reading off the base of possible post types to search from from internal values; changing that negates those

    I am not sure I understand this. If you are basically explaining that in setting the post_type to any we are going to include post_types that are not supposed to be included, then again we completely agree. I am glad you pointed this out. We can now find a solution for a future version. Thanks!

    - Brook

  6. leahkoerper
    Modern Tribe Support Rep
    Plugin Author

    Posted 2 months ago #

    Hi there,

    I just wanted to update you here. We were not able to fix this issue in time for our upcoming release (3.6). However, it is still very much a priority and we plan to work on it for a future maintenance release. We will keep you posted on our progress. Thank you for your patience and support!

    Best,
    Leah

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.