Custom Fields
Support General Retrieving post type from multisite

  • Creator
  • #5773

    Hello, I currently have a theme using metabox and a theme using WooCommerce. I'm trying to create a 'select_advanced' field using data from the 'product' post type of the theme using WooCommerce. Is this possible?

    Below is a sample of my code, which does not currently grab data from the wp_2_ tables in the DB.

    Thanks a ton!

    $meta_boxes[] = array(
    	'id' => 'featured_products',
    	'title' => __('Featured Products', 'framework'),
    	'pages' => array('page'),
    	'fields' => array(
    		// Select Products
    			'id' => $prefix.'select_product',
    			'type' => 'post',
    			// Post type
    			'post_type' => 'product',
    			// Field type, either 'select' or 'select_advanced' (default)
    			'field_type' => 'select_advanced',
    			'multiple' => false,
    			// Query arguments (optional). No settings means get all published posts
    			'query_args' => array(
    				'post_status' => 'publish',
    				'posts_per_page' => - 1,
    			'clone' => false,
Viewing 1 replies (of 1 total)
  • Author
  • #5780
    Anh Tran


    I'm afraid the post field can't get posts across your multisite. It uses WP_Query to get posts, which has effect only on the current site.

    To resolve this, you need to make your own query and get the posts. Then use select_advanced field to show them.

Viewing 1 replies (of 1 total)
  • The topic ‘Retrieving post type from multisite’ is closed to new replies.