You can use the $_SERVER['HTTP_REFERER'] to check the page where it redirected from
You can use it as below.
if($_SERVER['HTTP_REFERER'] == "path-of-page-you-want-to-check"){
//Do something here
}
Conditionally you can call functions like is_home(), is_front_page() to run that block of code in homepage only
Related Posts:
- redirect does not work in ajax function
- wp_redirect() – headers already sent
- Authentication / login mechanism (non wp-admin)
- Set front page as static page [closed]
- WordPress Theme Development: How to redirect templates the right way?
- Redirect Old .php URLs to New WordPress Page
- Redirect to specified page when insufficient permissions?
- Where to find the code that redirects requests on the static page URL to the home page
- I used single quote to design HTML of my WordPress blog. Now site redirects to index.php everytime than page.php or single.php
- Disable redirect canonical
- redirect_to how to make it simply work with get parameter or similar?
- Developing WordPress site behind a static site
- What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]
- How to add custom css file in theme?
- CSS not updating in browser when I change it
- Is wp_is_mobile() effective?
- How to remove search bar from a wordpress theme? [closed]
- Get url of thumbnail from the media uploader
- How to: Update live sites theme from version control repo via plugin or library? [closed]
- Adding items to page template dropdown on Page Edit Screen
- How to use logout function on custom menu link?
- Hide certain pages / posts on wp-admin, show custom filter
- use add_action(‘wp_head’) in a widget for generating dynamic CSS styles
- Front End Post Submit Form
- Page attribute template dropdown not displayed even the syntax is correct
- How to add a text widget during theme activation
- WordPress Theme customisation CSS
- Displaying wp menus by name without using theme locations
- Why does this loop only work on the homepage?
- Nesting Functions within Functions
- Theme check: Missing a text-domain
- Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
- Do I really need the div class entry?
- How to determine if post has widget content?
- Custom Script Section Only Echoes Text
- Best way to start becoming a wordpress developer
- Set multiple templates per post
- Place the page title into the short code
- create-guten-block in wordpress theme?
- Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite
- Displaying recent post excerpts on static front page
- approach to pass additional parameter in post URL
- Which html elements should be styled in wordpress theme
- WP didn’t redirect to canonical category URL
- WordPress Media Uploader in page template (On Front-end)
- How do i place same widgets multiple time by default on theme activation?
- Getting php_network_getaddress error : No such host is known?
- HTML added to editor when deleting shortcodes in Chrome browser
- Combining CSS files into a single cached one
- How to set a page as homepage in stead of the newspages?
- WordPress Theme Validator?
- Get the amount of posts on a given page
- How do I Redirect a WordPress Page?
- How do I use a color from theme options?
- Is there any way to register custom background images like header images?
- How to make javascript work on theme options page
- Second menu has the first menu ID
- Some Pemalink problems, probably caused by wrong .htaccess configuration?
- How to include a file only on dashboard widgets page?
- What exactly is “wordpress theming”? [closed]
- Present Color Schemes to Clients
- WP_Query $gallerypage->the_post() giving Undefined offset: 0
- Manually Create PHP Page For A Redirect
- Change Image Sizes for Mobile Theme
- Dynamically Populating Image/Excerpt/LInks from Pages in WordPress
- Trouble in creating a custom template on twentyeleven theme
- language support in a custom urdu theme
- Janrain/Simple Modal under Redirected Domain
- If I remove Category base from my URLs, how difficult will rollback be?
- Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
- Adding popup support to the theme
- In wordpress customizer div still showing even if I hid it with javascript
- How do I change the color of individual page titles in WordPress?
- Programatically Created Menu not Editable in Dashboard
- How toprint informations in footer
- How to implement pagination in category.php template
- Embedding CodePen Calorie Script – jquery error
- How to reduce the vertical space above and below a ul list uniformly with one command?
- Is it possible to echo a woocommerce prouct attribute discription?
- WordPress Menu item > Sub menu Class update
- Duplicate child theme incl. design changes
- Why .widget-area is outside of .site-content in Underscores starter theme?
- How can I use a different template file for the blog index’s paginated pages?
- Redirect users in first login to a dynamic link
- How to customize the colors within a stylesheet using a WordPress setting
- Images use & location, on new wordpress theme
- On wordpress, how do i require specific dimensions from user uploads only
- how to create export / import theme options in wordpress without plugin
- WordPress Customization API overwrite LESS variable
- Create image with imagepng() (fails at header)
- Can you create a custom page with content in the center already defined?
- Horizontal Navigation
- Custom image size doesn’t work
- Paginated WP_Query doesn’t return 404’s, even when posts don’t exist
- How to assign the default file at “Appearance > Editor”?
- load src of images that attachs in wordpress’s post
- Add Field To All Pages
- Creating custom function in wordpress to return data from database
- WP Customizer get control value on change
- Activate Gutenberg group block for theme