There are two more possible ways
-
Use the browser’s history API to manipulate the URL displayed at the address bar/ history.
-
Use AJAX
Redirection is the best solution for 100% browser support and it is probably the easiest to implement. You don’t need to use any hook with that just do the processing without generating output and then redirect back to the page. Something like
if (isset($GET['posttodelete'])) {
delete post
wp_redirect(utl with 'posttodelete' stripped out of it);
} else
normal loop;
But your users might prefer the AJAX solution which requires much more coding but gives the best user experience.
Related Posts:
- Using action hooks inside of a shortcode
- Redirect users on specific post category or category page
- Enclosing Shortcode Within Another Enclosing Shortcode Breaks Output Functionality
- How can I collect and output all attributes of all executed ShortCodes?
- A good hook to check authorization and redirect?
- Which hook should be used to add an action containing a redirect?
- Redirect function inside a Shortcode
- Why are you using add_action for shortcode?
- How can I put a wp_redirect into a shortcode?
- Redirect logged in users if they are on a specific page
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- after login that will redirect user role into a page
- Pros and cons of actions over shortcodes
- template_redirect to accompany with a shortcode
- manipulate a plugins shortcode
- Print shortcode in custom action hook not where the shortcode is entered
- wp_redirect() not working on form submission with init hook
- Remove and restore one shortcode
- Firing a function AFTER redirect
- passing parameters to do action from shortcode to wp_footer
- Convert HTML Script to Shortcode [closed]
- How to redirect if a background request is still being executed
- Login form from shortcode doesn’t redirect after successful login
- How to wp_redirect on ‘init’ hook on condition of current post id?
- WordPress redirect redirecting too many times or not at all
- Redirect no product url’s to static url
- Use another action instead of the shortcode API to display the last time a user logged in
- redirect if shortcode exists
- Modifying the wordpress login page and then referencing it with a shortcode problem
- What hook to use to redirect based on $post
- contact form 7 :create shortcode usable in email message [closed]
- Set redirect for need login
- ‘Conflict’ with action deleted_post and is_admin()
- How to create shortcode for auto login after registration
- Members only Passthrough
- Add an access code form to call a unique page based on page without registration
- Cannot modify header information – headers already sent
- Hook into existing shortcodes to manipulate the attributes?
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- how to limit search to post titles?
- Combining shortcode and get_template_part
- Escaping quotes from shortcode attributes
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How to detect if a Shortcode is being called on a page?
- How to get current page title inside a page itself in a shortcode and in page content
- shortcode inside another shortcode
- Custom Shortcode AJAX 400 Bad Request
- shortcode to create dynamic dropdown box form shortcode attributes
- Login to wp-admin “redirect_to” points to wrong URL after migration
- Count singular post views automatically
- conditional shortcode not working
- Can’t seem to get [shortcode]s to work
- wp-login.php — redirect logged in users to custom URL
- nested Shortcode doesn’t work
- TinyMCE get selected text and underlying HTML
- template_redirect not being called when using ajax
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- other shortcodes in Contact form 7 MAILS [closed]
- Wrap shortcode inside custom block
- Creating a shortcode based on users preferences
- Get a post’s thumbnail url or display default image in shortcode
- basic shortcode – Why 1st paragraph not wrapped in p tag, but 2nd is
- Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite
- Include tags in the body of a post
- Remove shortcodes that are different (but same pattern) in each post
- Place a URL parameter value inside a WordPress short code
- How to list all WC products by their attributes values?
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- WP didn’t redirect to canonical category URL
- Conditionally Loading JavaScript/CSS for Shortcodes
- Override the WordPress core function wp_referer_field
- Add JS in footer via shortcode?
- WordPress Shortcode / Only works in classic editor, gutenberg error / invalid json response
- Woocommerce – Adding row to cart table
- How to fix automatic redirects?
- Do shortcode in template file
- Pass instance number to shortcode child
- Add shortcode within the_content()
- hard code shortcode only on specific category
- Replace Data In Post & Update Meta Field Post Is Saved
- How to redirect a child page to its parent page?
- How to include shortcodes and pdfs in WordPress search without plugin?
- Gutenberg Shortcode will turn html to html entity
- Need help in setting up a transient using API Key and if possible updating it in the ACF field
- the_content() not showing the content in good order (with a shortcode)
- How to Enable embedding WordPress default gallery in comments?
- Print shortcode according to site language
- Remove a short code and update it’s content (AJAX)
- using wp_rewrite but keep the original url in the address bar
- Timber – don’t display shortcode
- Use ACF array values in shortcode
- Grab meta data before post is saved
- php in a shortcode
- Plugin Hook: Get posts
- Clarify: Enqueueing scripts within shortcode only loads in footer?
- What makes a placeholder resizable in Tinymce?
- Multi-part form and wp_redirect()
- Other pages fine but wp-admin showing ERR_TOO_MANY_REDIRECTS Error
- 3 shortcodes 2 won’t render [closed]