• I’ve got a function which have to return meta keys

    function deco_get_metakeys() {
    	$args  = array(
    		'post_type'      => 'post',
    		'posts_per_page' => - 1,
    		'meta_query'     => array(
    			'relation' => 'OR',
    			array(
    				'key'   => 'deco_post_is_slide',
    				'value' => 1,
    			),
    			array(
    				'key'   => 'deco_post_choose_redaction',
    				'value' => 1,
    			),
    			array(
    				'key'   => 'deco_post_interview',
    				'value' => 1,
    			)
    		)
    	);
    	$query = new WP_Query( $args );
    
    	while ( $query->have_posts() ) {
    		$query->the_post();
    		$exclude_post[] = $query->post->ID;
    	}
    
    	return $exclude_post;
    }

    It return empty array, can somebody explain where did i go wrong?

  • The topic ‘Help please with function’ is closed to new replies.