Current Page Form Action

Short and sweet … figuring out the URL of the current page or post – for instance if you are generating a form from within a shortcode and want to determine the action URL – can be done in one line.

$action = get_permalink($GLOBALS['post']->ID);

You could also bring the $post global into scope if you hold a grudge against using the $GLOBALS superglobal.

Speak Your Mind

*