Support » Fixing WordPress » WP_Query in Admin pages lose the Taxonomy

  • I’m unable to select my Custom posts while in the admin section. This is so I can use a related products select box.

    My code works fine if it’s being produced for the front-end. Admin pages just do not accept my taxonomy selection argument.

    I’ve tried WP_Query, wp_get_recent_posts, and query_posts functions. Please assist.
    sample code…

    function gk_list_recipes_by_cat($call = ''){
    			global $post;
    
    			$query = array(
    				'product_types' => 'Bacon'
    				'post_type' => 'products',
    				'posts_per_page' => -1,
    				'orderby' => 'post_title',
    				'order' => 'ASC',
    				'post_status' => 'publish',
    				# 'product_types' => $call
    
    			);
    			$queryObject = new WP_Query($query);
    			$related = array();
    			if ($queryObject->have_posts()) :
    				while ($queryObject->have_posts()):
    					$queryObject->the_post();
    					$related[$post->ID] = $post->post_title;
    				endwhile;
    			endif;
    			//endforeach;
    			return $related;
    		}
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter graphicagenda

    (@graphicagenda)

    more info: all the pages return, and not the selected category.

    Thread Starter graphicagenda

    (@graphicagenda)

    My issue was that taxonomy was generated via “GD Custom Post Type” *plugin*. If I hard coded register_taxonomy() right before the function, I get what I need out of the admin area. Therefore I hope to be able to continue with the same functionality that the plugin delivers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP_Query in Admin pages lose the Taxonomy’ is closed to new replies.