Support

Account

Home Forums Front-end Issues get linked page ID

Helping

get linked page ID

  • Hello,

    I have a product in woocommerce, it has a custom field using a page link. This works fine.

    When I am on that page, i would like to link back to the woocommerce product and also get all the woocommerce custom fields to use on this page.

    this is my first attempt at the code with no luck. I have tried linking with both the current page ID and the permalink, neither work

    $current_url = get_permalink();
    echo $post->ID;
    
    $args = array(
      'numberposts'	   => 1000,
      'post_type'	   => 'product',
      'meta_key'	   => 'page_link',
      'meta_value'	   => $post->ID
    );
    
    $loop = new WP_Query( $args );
    
    echo $loop->request;
    
    while ( $loop->have_posts() ) : $loop->the_post();
    
    the_title();
    
    endwhile;
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.