• example code on page
    <input placeholder="20" name="distance" type="text" value="[qv var=distance]" />

    example code in functions.php file

    function get_qv($atts)
    {
        return get_query_var($atts['var']);
    }
    
    add_shortcode('qv', 'get_qv');
    
    add_filter('query_vars', 'custom_query_vars');

    but this
    [qv var=distance]
    is showing on the page to the end user.
    I have been looking for ways to fix it.

    I found this

    “As such you should use your snippet to output the full value parameter (value=”xyz”), or the entire input itself.”

    no idea what that means.

    Any ideas?
    Thanks

Viewing 1 replies (of 1 total)
  • Hi,

    Did you put this:

    <input placeholder="20" name="distance" type="text" value="[qv var=distance]" />

    in your posts/pages or in a PHP page? If inside a page template then you will have to use do_shortcode

    Hope it works. 🙂

Viewing 1 replies (of 1 total)

The topic ‘shortcode not working inside input field value’ is closed to new replies.