On my site/blog, I have one landing page, through which I collect all ‘Consultation Requests’ – let’s call it:


On every page/post of the site is a navigation link, with the text ‘Request Information’.

For each page/post that CTA appears, I want it to have a unique URL which passes the post/page title to my landing page, e.g. http://example.com/conso-request/?xxx=my-great-post

I've got the element id to work with btw.

What's the best way to accomplish this?

1 Answer 1


I think adding the new link by hook will be the best way.

function new_nav_menu_items($items) {

    global $post;

    $landinglink = '<li class="home"><a href="' .get_page_link('YOUR_LANDING_PAGE_ID_HERE').'?from='.$post_slug.'">' . __('BLAA') . '</a></li>';
    $items = $items . $landinglink;
    return $items;
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );

Change 'YOUR_LANDING_PAGE_ID_HERE' with landing page ID. Cheers

  • Thanks a lot - sorry I'm new to this. How do I use this?
    – Galwegian
    Apr 21, 2017 at 13:24
  • just place this code in functions.php of your theme. And you are good to go. Just keep in mind to change 'YOUR_LANDING_PAGE_ID_HERE' with landing page ID. Apr 21, 2017 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.