2.39.0 query changes

Home Forums MapPress Support 2.39.0 query changes

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #11126

    After upgrading to MapPress 2.39.0 I noticed that a mashup was showing draft status posts and was only showing 10 posts.

    I added “&post_status=publish&posts_per_page=-1” to the mashup query to resolve the problem.

    Did the default query settings change in 2.39.0?  I thought the defaults were to include only status=publish (not draft) and posts_per_page=-1.  Maybe I just never noticed this before, but I’m pretty sure that mashup was displaying as expected prior to 2.39.0 and without the added query parameters.


    Hi Brad,

    You’re absolutely right on both issues.

    Thanks for letting me know.  Look for 2.39.1 later today with a patch.

    On the draft posts: the mashups now use AJAX to query the database.   WordPress treats front-end AJAX calls as though they came from admin screens.  Apparently in the WP query code there is a hard-coded check that adds all statuses if the query is coming from the admin – and since WP can’t tell the query is really from the front-end, it returns all posts.

    There is a 3-year-old ticket about this that seems to have been resurrected again recently:

    Maybe they’ll fix it this time.  Meanwhile, I’ll update the query code to default to ‘publish’.  I don’t see the is_admin() check doing anything else so that should fix the problem.

    As for the posts_per_page – I switched it to support paging the results, but since that function didn’t make it into this release, I’ll set it back to -1 by default.

    Thanks again, please let me know if you notice any other issues.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.