I can’t find solution for this …
URL: www.foo.com/some_page/?name=John
Page content:
Hi [Name]!
Worpress still redirects back to www.foo.com/some_page/
I tried everything …
I need something like the following in functions.php
function name_shortcode() {
return $_GET['name'];
}
add_shortcode( 'Name', 'name_shortcode' );
And on another page: Click here www.foo.com/some-page/?name=John
If I understand your question correctly, you want to be able to get the parameter from the url, add it to the shortcode so you can add the parameter to the content.
See if this works:
add_shortcode('name', 'get_name');
function get_name() {
return $_GET['name'];
}
In the wordpress backend editor you would have something like:
Hello [name],
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.