Tag Info

Hot answers tagged

3

As stated in @ambroseya's answer, its supposed to work like that. Once you declare a meta query, even if you aren't looking for a specific value, it will only query posts with that meta key declared. If you want to include all posts sort them by the meta key, use the following code: $args = array( 'post_type' => 'news', 'orderby' => ...


2

You should be fine deleting empty custom fields. The main reason is, that get_post_meta( $id, 'metakey', true ) returns an empty string if the field is not set, so it is the same as having an empty record set. get_post_meta( $id, 'metakey', false ), returns an empty array if no value is set, so you should be fine too. The only problem you could face is ...


1

That's actually how it works. If you want to do that without adding table rows, you'll have to do two queries. One with the meta_key that has the limited results, and the other that gets the whole list; then use PHP to compare the two query results (possibly removing the meta_key results from the other query to remove duplicates, or whatever makes sense in ...



Only top voted, non community-wiki answers of a minimum length are eligible