Forums

need to pass a variable to an array (4 posts)

  1. jkd77
    Member
    Posted 9 months ago #

    I'm trying to do this:

    $myVPname = get_the_title();

    $vpArgs = array(
    'post_type' => 'loan_closings',
    'meta_key' => 'originator',
    'meta_value' => $myVPname //if I use 'Fred Smith' it works
    );

    $vpLoop = new WP_Query($vpArgs);

    Thoughts?

  2. alchymyth
    The Sweeper
    Posted 9 months ago #

    the syntax looks ok;
    have you tried to print $myVPname to see if it contains what you assume?

    just bofore the line with your query;
    example:
    print_r($myVPname);

  3. jkd77
    Member
    Posted 9 months ago #

    actually i had used echo $myVPname;, and that did output what I expected. I tried print_r() and it gives me the same. Does it matter that my value has spaces in it? I've even tried to convert the value to a string first...

  4. jkd77
    Member
    Posted 9 months ago #

    Help?

Reply

You must log in to post.

About this Topic