Let’s say your site’s address is example.com
. When you want to redirect to example.com/page/subpage
you should use site_url('/page/subpage')
.
I assume the WordPress address is http://127.0.0.1:8000
. You have in your code
site_url( 'http://127.0.0.1:8000/?page_id=5' )
and it will be converted to this address: http://127.0.0.1:8000http://127.0.0.1:8000/?page_id=5
.
Try using this redirection:
wp_safe_redirect( site_url( '/?page_id=5' ) );
Second issue, if you’ll take a look at code reference, you will find there:
wp_safe_redirect() does not exit automatically and should almost always be followed by exit.
Related Posts:
- Refresh page after form action
- Ninja form Redirect depending on text field content [closed]
- Redirect to another page if the user is logged in when pressing again the login button on menu bar
- Contact Form 7 If Condition
- How to properly refresh page after form action?
- Init action and refresh page after form action
- template_redirect action only firing if logged in
- How to change form action of wp-login page with a function
- Sending Messages Back to the Template After Processing?
- remove_action on after_setup_theme not working from child theme
- Remove Actions/Filters added via Anonymous Functions
- Trying to use add_action and do_action with parameters
- Check if post is being published for the first time, or is an already published post being updated
- WordPress Theme Update Action?
- add_action in a function, is it possible?
- How can I get $id variable in widget’s form function?
- Using a private method as an action callback from within a class
- Add action hook conditionally – only when home.php in use
- Using add_filter() in Widgets
- How to call WordPress functions from a form processing script
- How can I tell if I’m on a login page? [duplicate]
- what is the meaning of settings_fields()
- Change meta tags programatically
- Convert hyphen to underscore in permalinks
- How to hook into the quick edit action?
- Reuse variable in hook callback
- update_post_meta for custom field not working upon form submission
- WooCommerce add_action hook results in 500 error
- WordPress registration and contact form 7 [closed]
- How would go about if I just want a temporary function?
- Pass parameters to function through an action
- Accepted arguments value in hook functions
- Which action hook to use for function?
- Custom HTML in specific category single page and its descendant categories
- How do I redirect all 404 error url to Subcategory url
- WordPress upload_mimes not working for front-end uploads of 3D files
- Modify a function without editing template
- Don’t delete a page if it holds users
- How do I add Bootstrap and LESS to my migrated WordPress site?
- 404 redirect to previous category
- Login Redirect if Logged in from Specific Page
- Is there an alternative to get_template_directory_uri()?
- Wait a result before enqueue
- Multiple Loops Meta Data
- Incorrect redirect after commenting
- Function added using `add_action()` not being called
- jQuery does not work
- Override the WordPress core function wp_referer_field
- Two functions with different arguments and add_actions, but identical code
- I can’t seem to install Font Awesome locally [closed]
- How i can put $_GET codes in function.php?
- Scripts not loading when using the wp_enqueue_scripts action
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- problem loading stylesheets to wp_head dynamically
- WordPress redirect redirecting too many times or not at all
- current_user_can comma list vs OR (||) list
- Solved: redirect to another page using functions.php
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- Logout Redirect and also WP-login.php Redirect
- Changing where my author box is printed
- Insert Content Before div#main from the functions.php File
- Redirects based on a JSON file
- Use add_action within template
- Problem in using Customizer
- Problem with custom function when I go back with the browser
- Replace admin header logo with an image
- New checkbox in custom widget isn’t saving data
- How to use wp_enqueue_script properly?
- This code is supposed to only allow user to be authenticated if accountVerified is equal to 1, but it still allows user to be authenticated otherwise
- Using get_terms for custom taxonomy in functions.php
- Redirect to one of two pages after data submitted, depending on the current url
- Issue passing action class to nested function. Admin Columns
- Does hook have an effect on increasing the page load?
- What is the earliest Hook a Script can use?
- How do I trigger WP CLI DB export using a PHP function?
- post value to function with Ajax and jQuery
- How do you insert code into the sidebar?
- How Do I Unhook This Parent Theme Function?
- Make a treatment before the action of the form
- Wildcard 301 Redirect Using Theme Function
- use add_action in a shortcode (gravity form – WordPress)
- wp_footer hook causing text to show on bottom of page
- Redirect specific author posts to another url
- WordPress hooks to call a function inside a construct
- True parameter but jquery register in header and not in the footer with wp_register_script
- Fatal error: Call to undefined function add_action() – an untouched problem
- previous_post_link inside of a function?
- How to create a function to redirect a specified page to another page
- Language switcher for subdomains
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- How to request login for user but not for bots
- function to return comma separated list of meta values
- Do something when user creates post (that’s pending)
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?
- add variable to actions/functions across different files (woocommerce)
- Help finishing script to export WP user data when form submitted
- Directing to functions.php the correct way
- Get all users from role and add to dropdown (select) – wordpress, javascript
- Can’t find function which is called in a wordpress theme
- delete_term is not working properly with add_action()