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
- force enqueue script to be first in order of prominence
- Modifying a JS file with data from plugin settings
- How to call plugin path in JS?
- How do I sanitize a javascript text?
- How can a Firebase user registration and login be integrated into a WordPress site?
- How do I make my wordpress page more friendly for mobile viewers?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How can I make content disappear when a user logs in?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- ‘Lazy loading’ list of posts with pagination
- Check javascript file Proper way in functions.php
- How to include admin-ajax when loading external javascript
- how would I include a js file with tags into wordpress?
- Custom url structure for custom template
- Google Maps and Yandex Maps doesn’t work correctly
- wordpress custom login successful redirect hook
- Prevent CSS/JS loading when plugin is not used
- How to create Repeater fields using Advanced Custom Fields?
- How to create popup same as wordpress popup feature
- Gutenberg List Extension Block
- prettyPhoto media loading very slowly in Chrome
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Using custom JS plugins with WordPress?
- Override Javascript in a Plugin?
- How can I check if on specific plugin generated page or child
- How to redirect a URL with parameters?
- Change upload folder for a CPT
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- add custom filters to the event calendar plugin programatically to frontend [closed]
- Can you use another Profile Builder shortcodes through advanced custom fields
- add input in custom javascript from WordPress pages/posts
- Redux Framework: Page freezes on typing in Editor
- ACF: post query, hide duplicate values [closed]
- Delay JavaScript files from loading
- “Conflict” with jQuery (or its plugins)?
- WordPress 4.3 broke meta redirect (with url params plugin)
- How to execute a plugin on a single page only?
- MediaElement.js works on one site but not the other?
- Keeping and updating ACF and ACF Pro at the same time
- How to get specific string/value from an array? php [closed]
- Background Music WP [closed]
- Adding a simple Javascript file with a plugin
- Social share buttons text shows up on post excerpts
- Translation to ACF relationship field
- How to force load a page in plugin?
- Dropdown menu on click change
- How do I override all stylesheets and scripts without a plugin
- Plugin Admin panel checkbox unchecked after submit
- Custom Plugin scripts from admin working in frontend
- Send Array from JS to php file then insert it in wp database through a plugin
- Replace the_content with ACF Flexible Content via function
- acf backend error handling
- How to override Plugin javascript function : $(‘body’).on(‘change’,’.class’)
- Connect / Login WordPress Hosted Website or Blog with NodeJs
- How to fetch WordPress database values in JavaScript widget
- Possible way of having multiple Gutenberg instances for a page?
- Woocommerce add products to cart
- Show popup on click
- how i retreive the post content while editing it in real time however the editor is tinymce or gutenberg
- How to properly enqueue jQuery knob on WordPress without conflict?
- Javascript not getting injected into page
- Why does my custom plugin only function correctly once per page?
- Images are broken in Wysiwyg Editor – ACF backend
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- make p tag collapsed after 3 rows
- How do I change the functionality of an image slider which is part of ACF?
- How to update all in-site redirect URLs to destination URLs at once
- Woocommerce – Change variations output
- Reverse count page view and show on other page
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- Will downloading a page builder plugin delete my existing data?
- Customizer preview URL not updating when settings reset to default
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- Get a Taxonomy values in an array
- .htaccess file doesn’t work, with hundred tries
- wp_enqueue_scrpts seems not to get called
- show-hide based on select option jquery wordpress
- Speed issues because of CSS & JavaScript
- How to create a dashboard for logged-in users with custom functionality? [closed]
- Creating a user ‘add custom field’ section
- Javascript not working
- Creating custom URL for async content
- How do I convince this button to do something when it is clicked?
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- Simple WordPress function / plugin to redirect a site
- Element works, but not on wordpress site [duplicate]
- How ACF Advanced Custom Field works with Woocommerce Single Product [closed]
- how woocommerce swatch color name when hovered or selected
- WordPress shortcode plugin not working
- FacetWP: Plugin breaks button/modal functionality inside searchable content area
- TypeErrors with Yoast, jQuery in conflict?
- Count div with class (.length) only shows 0 [closed]
- how to show selected options drop down menu values in attributes field in after saving post.php
- True/False ACF field returning null by default even if default value is true
- Using ACF to allow user to add and edit multiple saved forms
- Vanilla javascript in custom gutenberg block not working