Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my php application. Its using wp_redirect($url, Statuscode) method to redirect to next page.

I have around 10 pages. When I redirects to certain pages it calls some method. But I am not able to locate where method calling is defined.

Please check code below, On wp_redirect its calling a method also and then redirecting to next page.
($response->headers['OSSO-Status-Code'] == 404 || $response->headers['OSSO-Status-Code'] == 422) {
wp_redirect("/membership/member-register-new", 302);
exit();
}
But if a changes url to ("/membership/member-register-Validate") then it is redirecting to next page without any other method calling.

My application is part of wordpress. I am new to php and wordpress. This code was written by old developer.

Thanks

What I have tried:

($response->headers['OSSO-Status-Code'] == 404 || $response->headers['OSSO-Status-Code'] == 422) {
wp_redirect("/membership/member-register-new", 302);
exit();
}
Posted
Updated 6-Apr-18 7:32am

You are working within the WordPress framework, and it has all sorts of its own functionality that are not part of PHP, even if they are written in it. Your Wp_redirect() for example, is unique to that environment.

Now, for a normal web page, you could redirect from the local page using javaScript, with, for example, location.assign(...target url...).

PHP is aware of the page that you came from when you access it on the server, but how could it or any application know where it is to go next? You need a list of some sort. Or links.

But most of all, if you plan on using php, then you should learn it.
Try HERE[^].   It worked for me

 
Share this answer
 
v2
Comments
Renuka Garg Phatak 29-Mar-18 10:38am    
Thanks Balboos.

So is there any list in word press which keeps information about all pages? It seems there is some kind of list/Information maintained somewhere in my application which defines two category of pages, one category which requires validation before redirection and one category doesn't require any validation.
Can anyone help me how where in word press this will be defined?
W Balboos, GHB 29-Mar-18 13:44pm    
Wordpress is completely database contained. Even the pages. There are probably online forums about where these things are stored and how they work together - but that requires you have access to that particular database. Unless it's your own copy, you most likely don't - will need to find whatever interface it has available for such control.
Renuka Garg Phatak 3-Apr-18 16:09pm    
I don't have access to database.
But It seems some code written in any file like header.php or some config file where we can call particular function based on page name.
if ispage('member-register')
ocot_session();
Not able to locate file. Also couldn't find if any category for pages is defined.
W Balboos, GHB 4-Apr-18 6:20am    
I suggest that you pause in your work and study how WordPress actually works (if you plan on continuing to use it). I create my web pages "from scratch" and they are just plain files (.php, .js, .htm, .h and .css for example) and they are stored exactly where I put them. You are in WordPress' world and you need to study how that world works.
Renuka Garg Phatak 4-Apr-18 13:57pm    
I login into wordpress. In All pages there are some wordpress pages which are redirecting to my Custom php pages (<?php require_once ABSPATH.'wp-custom/pages/member-register-new.php'; ?>).
I un-published existing page. I created new word press page with same name which is redirecting to same old php page. It worked fine. Now it didn't called any method on redirection. I didn't make any changes to any config file etc. I just deactivated old page and created new page with same name.
It was happening due to custom fields. Custom fields were set for pages. These custom fields used to call methods on page submit or page loading.
I change value of custom field for respective page and issue resolved.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900