[wp-trac] [WordPress Trac] #20079: wp_query excludes posts without custom field from search

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 20 01:58:07 UTC 2012


#20079: wp_query excludes posts without custom field from search
--------------------------+------------------------------
 Reporter:  gdah.ayoub    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  3.3.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> Merging these arguments with the query in search, excludes posts that do
> not have the custom field 'statut' from search.
>
> {{{
> $args = array(
>                 'posts_per_page' => $per_page,
>                 'orderby' => 'title',
>                 'order' => 'ASC',
>                 'post_type' => 'medicament',
>                 'post_status' => 'publish',
>                 'meta_query' => array(
>
>                                   // exclude non commericalisés
> médicaments
>                                   array(
>                                     'key' => $prefix.'statut',
>                                     'value' => 'Non commercialisé',
>                                     'compare' => '!=',
>                                     'type' => 'CHAR',
>                                   ),
>
>                                 )
>         );
> }}}

New description:

 Merging these arguments with the query in search, excludes posts that do
 not have the custom field 'statut' from search.

 {{{
 $args = array(
         'posts_per_page' => $per_page,
         'orderby' => 'title',
         'order' => 'ASC',
         'post_type' => 'medicament',
         'post_status' => 'publish',
         'meta_query' => array(

                 // exclude non commericalisés médicaments
                 array(
                         'key' => $prefix.'statut',
                         'value' => 'Non commercialisé',
                         'compare' => '!=',
                         'type' => 'CHAR',
                 ),

         )
 );
 }}}

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20079#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list