Support » Alpha/Beta/RC » Behavior of the 'posts_search' filter has changed

  • Resolved David Lingren


    In WordPress version 3.6.1 and earlier, the “posts_search” filter was applied unconditionally, i.e., even when the “s” query argument was empty. You can see this in lines 2215-2216 of wp-includes/query.php, which are outside the “if ( !empty($q[‘s’] ) )” block of code which precedes it.

    In version ‘3.7-RC1-25851’, the ‘posts_search’ filter has been moved into a new function, “parse_search” (wp-includes/query.php lines 1917- 1971), which is only executed if the “$q[‘s’]” argument is not empty.

    This makes it impossible for a plugin to add a search clause to a query which does not have one to begin with. It is a change in filter behavior from earlier versions, which state that the filter will “Allow plugins to contextually add/remove/modify the search section of the database query”.

    Please move the filter back to its original location after the “if ( !empty($q[‘s’] ) )” block and before the “// Taxonomies” block which follows it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Sergey Biryukov


    WordPress Dev

    Thanks for reporting, created a Trac ticket:

    Mushviq Abdulla


    Здравствуйте Сергей. Я присоединился к команде WordPress из Азербайджана. Переводы Азербайджанского языка WordPress,имеет большое количество ошибок. Пожалуйста, помогите мне, чтобы исправить эти ошибки. Орфографические и грамматические ошибки в переводах очень достаточно. Хотел бы поблагодарить ранее.

    Moderator Sergey Biryukov


    WordPress Dev

    Mushviq Abdulla, you should submit a request on the Polyglots blog to create an Azerbaijani translation team if it doesn’t exist yet.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Behavior of the 'posts_search' filter has changed’ is closed to new replies.