Changing the function to the following works, as it checks to see if the form was submitted from the correct page:
function my_foo_registration_redirect( $redirect_to) {
if ($_SERVER['HTTP_REFERER'] !== get_the_permalink(1693)) {
return $redirect_to;
}
$redirect_to = '/videoguide-startpakke';
return $redirect_to;
}
Thanks a lot for the super helpful comments!
EDIT: Here’s a slightly more polished solution
function my_foo_registration_redirect( $redirect_to) {
$post_id = 1693;
$post = get_post($post_id);
$slug = $post->post_name;
if ($_SERVER['HTTP_REFERER'] !== get_the_permalink($post_id)) {
return $redirect_to;
}
$redirect_to = $slug;
return $redirect_to;
}
Related Posts:
- How build a custom login/register form with error handling?
- Integrating WordPress to my website, while keeping my own authentication system
- How to disable wordpress confirmation email for new users
- wordpress separate registration for different roles
- Conditional Statement – check if post has an attachment image
- Authenticating to WordPress, using my own authentication two-factor system
- Best way to create a user programatically
- Trying to use Ternary operators with WP Conditionals
- How to add specific menu on a specific page or pages
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- How to do conditional publishing?
- Remove username in emails or swap username for email
- Trigger Woocommerce New User Email
- Passing the page ID to a login php script
- How to send user data in json format to another server when user register on wordpress site in PHP
- items_wrap not working
- conditional statement for custom taxonomy
- WordPress shows registration link for non logged users
- Add user settings to specific roles
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Create a new usermeta field for users
- What’s the best user registration library to integrate WordPress?
- Is it necessary to sanitize wp_set_password user input?
- Anyway to output the registration form like the login form with wp_login_form()?
- How to give new users two specific user role options upon WordPress user registration
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- What is the correct way to write this conditional statement?
- Reordering Buddy Press profile navigation [closed]
- User management system similar to wordpress one?
- Custom user login page by creating a plugin
- How can I save unique user data on my site? [closed]
- user_profile_update_errors hook not executing
- Paypal form integration with wordpress registration form without plugin [closed]
- Is_front_page inside header.php is always returning true
- Advanced Custom Fields – display label and value only if value entered
- PHP conditional script issue
- User register hook is not working in woocomerce register form
- Password minimum length in personal subscription [closed]
- How to check if the current page is at a specified path in the URL?
- Run a code only on theme activation only during first activation
- Fatal error: Call to undefined function register_new_user()
- Add class to DIV depending on page loaded
- How Can I Edit the Registration Code?
- How do you create two separate Register pages?
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Custom Registration username_exists / email_exists
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- Custom User Registration script only allowing usernames with 16 characters
- How to make a conditional statement within $output in shortcodes.php?
- Conditionally remove comments and post meta in functions.php
- exclude custom post type from running a function
- include content within conditional statement?
- Show label for value only when value exists, basic php
- Custom User registration system
- Conditional formatting on data fetched from MYSQL
- Uploading/integrating custom user registration page
- Find and print first entry from WordPress post in custom excerpt?
- Including user data in “new user notification email”
- Adding if statement
- Issues adding Recaptcha v3 to WordPress Registration
- Change Login or Logout text based on status
- Help hooking into user_register
- How to auto-generate random numbers in username?
- Attaching an upload to a user
- Creating a custom register form
- Newbie question. Login/Registration. New PHP page
- Jetpack: Display Site Title when no Site Logo
- If else statement based on referral URL
- Registration form not registering First and Last name
- If Month=Particular month display content [closed]
- Php conditional help needed
- Editing a WordPress plugin to add my own functionality
- how to register a second page-template
- Custom Meta Box If Else Statement
- Hide a nav menu item based on get_user_meta results
- How do I reformat this to add php inside php?
- Null value given when confirming email’s
- Not able to see the error [closed]
- WCFM Custom form
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- Add a custom user meta data on registration based on user email
- How do I do so that people can register on my wordpress site?
- WordPress Infinite Scroll without using any plugin
- How to Join two tables from separate databases within WordPress
- How to find objects by terms
- How to get to a specific position in wp_query?
- Is it acceptable to treat a filter like an action?
- Fetch post block/field data as JSON with WordPress API
- Different Subdomain changes page content
- Removing the comment function within wordpress
- Bootstrap Carousel HTML structure and funny output [closed]
- Add a custom WooCommerce settings tab with sections
- No more get_option(‘date_time’) in WordPress 5.5?
- How to update post content of all posts with tag?
- Static home page ignored
- Custom single.php files for different post formats
- Remove /category/ from category (archive) page URLs (without using a plugin)
- JSON Object Value Show Undefine
- How to add SKU and remove product title from WooCommerce url?