Support

Account

Home Forums Front-end Issues get ID of woo commerce product through ACF page link Reply To: get ID of woo commerce product through ACF page link

  • The page link field returns the URL. Yes, this is just like using get_permalink(). When selecting pages/posts. ACF stores an array of post IDs. In order to reverse query this you need to do a “LIKE” query.

    
    $args = array(
      'numberposts'	   => 1000,
      'post_type'	   => 'product',
      'meta_key'	   => 'page_link',
      'meta_value'	   => '"'.$post->ID.'"'.
      'meta_compare' => 'LIKE'
    );