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 make checkbox required
- style.css not being rendered in browser
- How to hide blog by id wordpress multisite listing
- How to dowload and edit content of a website
- wp_kses allow checkbox class and checked
- Uncaught Reference error in Retina.js
- Make a custom field in admin post.php read only
- Is wp_mail plugin territory?
- how to add jquery to wordpress
- HTML TO WP Theme : Submenu goes down wp_nav_menu
- wordpress thumbnail onclick then modal will come out
- wp_editor some functionality not working on custom theme
- Update modified Shopify third-party theme [closed]
- Should I detect the device or the page first?
- Create settings field on button click
- Change site title color on individual pages
- Can’t upload images on new theme
- Git ignore everything except custom theme directory
- How does mediaelement.js work in WordPress?
- How to load mediaelement.js in theme template?
- HTML to → WP Conversion
- Add multiple sections, settings and controls at once to the Customizer
- Font not loading [closed]
- Images use & location, on new wordpress theme
- how can I re-utilize and class on a child theme
- How to change parent permalink?
- hide/show a div in wordpress
- How to get url image page the right way?
- Mobile view logo background colour in wordpress
- How to fix an issue with customizer live preview?
- how to call options on front end and add logo
- On wordpress, how do i require specific dimensions from user uploads only
- Jetpack Infinite Scroll Not Working
- Add a customize control depending wich radio setting is checked
- how to create export / import theme options in wordpress without plugin
- After WP 4.6.1 Update , Blog page started giving 500 error
- Breaking Categories Up into Individual Divs
- Providing updates to your WordPress theme
- How to perform str_replace on the results of wp_list_pages
- How to show children pages as array
- Different stylesheet for different pages not working fully
- Display current taxonomy slug in a post
- How to create multiple customizer controls in one control
- image sizes – finding and removing
- Display content on Single page
- One-Page WordPress Template
- Can I use WP Multi-site on a sub-domain with a different theme but use all the original site’s posts/pages?
- How to Apply Category Filter to Pagination
- wp_nav_menu custom walker class
- How do I use the add_query_arg function in a template tag like previous_post_link?
- Setting a fluid content width
- Make page accessible from another URL
- Any way to permanently translate themes?
- Activating theme in local MAMP installation results in HTTP ERROR 500
- Fallback dosen’t work when not using ‘menu’ attribute
- Load get_page_templates into select menu
- Missing hashtag with theme customizer header color
- New created Theme leads to malfunctioning Xampp Apache –> functions.php is cause
- WordPress Customizer Help with FontAwesome Icon
- Customizer_register theme options not saving
- Correct (and secure) way to escape url when using href attribute
- Understanding WordPress theme files and underscores
- New theme HTML5 Support for Search in WordPress 4.4
- “Add media” dialog is not showing any images
- Weird ‘theme update’ error [duplicate]
- Hook in parent theme Menu function
- How to debug theme (Theme is causing pages to have no style or HTML section)
- Clone a Post Tite and Custom Field into Custom Post type
- How do I remove p tag *insertions*? Disabling `wpautop` removes manual tags
- How to add custom nav_menu_css_class to certain menu only?
- Get chronological page order
- Create a variable with string, array or multiple values
- How to develop custom URL redirection
- get_posts is duplicating
- Query wp_postmeta into an array based on post_id
- Malformed RSS feed
- Need help with adding custom menu content
- Theme not uploading showing maximum upload size on live site
- How can I include the js and css file of my custom theme dynamically in header.php
- footer menu changes primary menu
- WordPress Blog Page displaying nothing
- WordPress Theme Developments – Start from another theme
- Full width thumbnail
- Access meta box checked value in another file
- Undefined index: custom_sidebars
- Adding a Class to an Getting From Post Content
- Using ‘get_template_directory_uri’ correctly