Use a custom URL parameter to edit a specific post ID

Created by Phil Kurth, Modified on Mon, 19 Sep 2022 at 05:29 PM by Phil Kurth


You may choose to set up a page containing a form that can be used to dynamically edit a given post ID. To do this, first set the `post` arg to "param". e.g;

[advanced_form form=“FORM_KEY” post=“param”]

Or, when using the advanced_form() function:

advanced_form( 'FORM_KEY', [ 'post' => 'param' ] )

When configured this way, the form will look for a `post` query parameter and use that. e.g; 


http://example.com/edit-post?post=123


Customising the query parameter

If you would prefer not to use `post` as the query parameter, you may customise the name as follows:

add_filter( 'af/form/editing/query_param', function ( $query_param, $form, $args ) {
  return 'some_custom_param';
}, 10, 3 );

With the following code in place, the form will look for a `some_custom_param` parameter instead of `post`. e.g; 


http://example.com/edit-post?some_custom=123

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article