• imagenparaweb

    (@imagenparaweb)


    Hi there..

    How can I show something if a custom field has a certain name OR another certain name.

    Something like these:

    If custom field is equal to “name1” or “name2” then show this…

    Can anyone post the correct code for this?

    Please!! thanks.

Viewing 1 replies (of 1 total)
  • I think this will work (untested):

    $args = array(
    	'post_type' => 'post', // Put your post type here
    	'meta_query' => array(
    		'relation' => 'OR',
    		array(
    			'key' => 'name1',
    		),
    		array(
    			'key' => 'name2',
    		)
    	)
    );
    $query = new WP_Query( $args );
Viewing 1 replies (of 1 total)
  • The topic ‘2 values for custom fields’ is closed to new replies.