Skip to content

Instantly share code, notes, and snippets.

<?php
// Passing the Page ID so the merge tags will recognize it safely outside the loop
global $post;
echo '<a href="'. esc_url( add_query_arg( array( 'gfgd' => $post->ID ) , get_permalink( get_page_by_title( 'Submit Form' ) ) ) ) .'" >Submit Form</a>';
// Passing the Page ID so the merge tags will recognize it safely in the loop
echo '<a href="'. esc_url( add_query_arg( array( 'gfgd' => get_the_ID() ) , get_permalink( get_page_by_title( 'Submit Form' ) ) ) ) .'" >Submit Form</a>';