WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change URL and pass variables (3 posts)

  1. radiozp
    Member
    Posted 1 year ago #

    I need to redirect submit button with variables to new url. So far I figured out the variables part

    global $mo, $yo;
    echo esc_url(add_query_arg(
    	array(
    		'var1' => $mo,
    		'var2' => $yo
    	),
    	home_url()
    ));

    So result is http://www.example.com/?var1=$mo&var2=$yo
    But now where my brain shuts down as I also need to change the path like:

    http://www.example.com/newpath/?var1=$mo&var2=$yo

    Any suggestions how to achieve that?

    Newbie I am

  2. bcworkz
    Member
    Posted 1 year ago #

    add_query_arg(
    	array(
    		'var1' => $mo,
    		'var2' => $yo
    	),
    	home_url('/newpath/')
    );
  3. radiozp
    Member
    Posted 1 year ago #

    I bow to knowledge :)

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic