rwmb_meta function not working

Support General rwmb_meta function not workingResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33199
    Travis SlonekerTravis Sloneker
    Participant

    I am able to get the shortcode to work but the function does not seem to be working. It is extremely straightforward documentation so I am unsure what I am missing.

    I have verified:
    * that I have the correct field name
    * that I have a value in the field
    * that if I try a different field name I still get no value
    * that I have no prefix for my field group

    Here is the simple bit of code:
    $listing_status = rwmb_meta('listing_status');
    print_r($listing_status);

    #33200
    Travis SlonekerTravis Sloneker
    Participant

    I think I know the issue but still would love some advice if you can help.

    <?php
    // WP_Query arguments
    $args = array(
    'post_type' => array( 'listing' ),
    'posts_per_page' => 9,
    'order' => 'RAND'
    );

    // The Query
    $query_listing = new WP_Query( $args );

    // The Loop
    if ( $query_listing->have_posts() && $listing_status != "Sold" ) { ...

    Above is a snippet of code. I basically want to check the listing_status field to decide if a post should be shown or not but I believe what the issue is, is that I am not trying to get the values within the while loop. I am attempting to do it outside of it which probably explains why I am getting no value.

    I'm not sure if you can get the value within the arguments.

    #33201
    Travis SlonekerTravis Sloneker
    Participant

    I was able to figure out a solution using get_post_meta. You can mark this as solved.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.