It should not be tough. As you suggested you can use ACF to add a custom field in post/page and then use the template_redirect action hook to check if the current page’s custom field is a valid URL as well as $_GET[‘redirect’] is true, wp_redirect to that URL.
function my_page_template_redirect()
{
if( is_url(GET_ACF_FIELD_VALUE( 'CUSTOM_FIELD' )) && !empty($_GET['redirect']) && $_GET['redirect'] == 'true)
{
wp_redirect( GET_ACF_FIELD_VALUE( 'CUSTOM_FIELD' ) );
exit();
}
}
add_action( 'template_redirect', 'my_page_template_redirect' );
Related Posts:
- Redirect to another page using contact form 7? [closed]
- login form should redirect to register page for in 1st login next time it should redirected to home page
- Pass a php string to a javascript variable
- Problem in loading javascript in footer
- Get post by ASC from custome field DATE picker
- JQuery not working in my plugin [closed]
- how can I link to a PlugIn admin-sub-menu page after processing a formular
- prettyPhoto media loading very slowly in Chrome
- How does automatic redirection for the redirection plugin work?
- Changed permalink structure. Need help with redirecting old posts
- How to load plugin after page is loaded – pagespeed issues
- add mediaelement.js plugins into WordPress video player control bar
- Shortcode button dosent work for all posts. Work for first post only
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- React JSX in WordPress Plugin Development
- Internationalization autocomplete JS variable
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- Landing Page Redirect Chain | http->https->https www
- Getting value from Advanced Custom Fields [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- How can you include a theme template file from within a plugin (i.e. WooCommerce’s Shop page)?
- Inserting HTML tag with ACF into shortcode
- Using custom JS plugins with WordPress?
- Override Javascript in a Plugin?
- Advanced Custom Fields plugin – get text from editor field and save it in a variable
- How to disable specific plugin in mobile version?
- Is there an earlier hook than login_head or login_enqueue_scripts?
- How can I check if on specific plugin generated page or child
- Best approach to fetch data from wp options to js file or php file
- Redirection based on location but without affecting search bots
- Pull out Advanced Custom Fields in Related post plugin
- Page Restriction and Redirect for Particular Levels or user
- Can someone please tell me what is wrong with my plugin?
- how to create site exit messages with destination url displayed
- Updating the Drag-To-Share eXtended share URLs?
- Scripts at the end of the page
- How to redirect a URL with parameters?
- wordpress site | All-in-one-cufon IE Issue
- Enqueue WordPress plugin scripts below all other JS
- How to add Internationalization in WordPress using Javascript/React?
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- Change upload folder for a CPT
- Using a post-signup hook to get user details
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Matching Chapters to a Custom posts [closed]
- How to get the element ID from new menu list that added with add_filter()?
- Advanced Custom Fields displaying on tag pages
- Override Plugin Script Fucnction in WordPress
- Time consuming callbacks in customizer
- Redirect already logged in users away from a page to a specific page base on user role
- Custom Fields with Pods not being translated
- Modifying a .js Function for Print [QZ Tray, WooCommerce POS]
- is there a way to link one of the field in ACF field group, to a field in a media attachment page? [closed]
- add image crop function like in wp customizer
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Executing Javascript when a New Post is Published
- Set featured image using javascript in post editor
- Display encrypted content on my website
- How to fix the woocommerce – adaranth.com redirection issue [closed]
- Is there a standard way to listen for an on change event of a posts featured image
- How to edit content before post update
- How to remove the inline styles from the content of a WYSIWYG editor field at the time of saving the post?
- Trying to create a private area custom for each user where they upload images to a server [closed]
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- add custom filters to the event calendar plugin programatically to frontend [closed]
- wp.media javascript issue with on select
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- Can you use another Profile Builder shortcodes through advanced custom fields
- add input in custom javascript from WordPress pages/posts
- Advanced AJAX Page Loader ignores other JS code
- How to insert HTML/JavaScript form into WordPress page? [closed]
- accessing wp.media api from a tinymce plugin
- Add custom JavaScript that is a combination of CDN/uploaded files and easily-edited code?
- How to load wp_editor via AJAX
- Redux Framework: Page freezes on typing in Editor
- dirname( __FILE__) returning wrong directory inside plugin
- How to get DEFER or ASYNC attribute to appear when I add a stylesheet with wp_enqueue_style from a plugin? [duplicate]
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- Using TinyMCE in plugin?
- Using window.onload with Ubermenu
- GeoMashup plugin: how to customize cluster markers / icons? [closed]
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- ACF: post query, hide duplicate values [closed]
- Paid Membership Pro with ACF [closed]
- Is there a loading priority for login_enqueue_scripts?
- How to use login_redirect with a user capability
- ACF only showing up in Homepage but doesn’t appears in all pages
- Delay JavaScript files from loading
- Advanced Custom Fields – Disable Users to Edit Custom Fields
- “Conflict” with jQuery (or its plugins)?
- Removing Automatic Redirects Without Plugin
- Using ACF default value to autoincrement a number field
- URLs Added to ACF Repeater Field are not working
- Advanced Custom Fields – Get value in other plugin file [closed]
- JavaScript in a PHP plugin
- Deactivate JS Script in Plugin Shortcode
- WordPress 4.3 broke meta redirect (with url params plugin)
- how to prevent all css and javascripts files from loading