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]
- The the_post_thumbnail without srcset?
- after_setup_theme always runs
- wp_redirect() function is not working
- What WP folder can I use to write files to?
- How to add default images for custom backgrounds?
- How to call the_excerpt() with tags or the_content() as an excerpt?
- Display a different theme for not logged-in users
- Custom Theme: The active theme is broken. Reverting to the default theme
- comment_form() generates the wrong action url
- How to set path with WP_Filesystem and ftp base / chroot
- Customize comment list markup
- Have WP Theme update from Git Repository
- A two column loop with one lead post
- Temporary redirect prevents getting $_POST array
- new theme permissions don’t allow me to edit
- Getting Permalink within the loop
- Allow users to add custom functions to wordpress theme
- Can a child theme based on Starker theme be released as free to use theme for public use?
- wordpress custom theme import and export options for sample data [closed]
- How to hook CSS file according to theme selection in the customizer section
- Link won’t show using the_permalink();
- What program can I use to preview my wordpress site?
- How exactly *does* unit testing work for themes?
- wp_nav_menu add something before closing container and after last list item
- qTranslate with my own theme and settings
- WordPress does not load page.php, return 404.php
- Make logo dynamic in wordpress
- Do i need to keep all the default WP templates files in a theme?
- Create a new page in WordPress theme
- where to split off footer.php
- How to show user online status on their posts?
- What is the correct way of getting parent styles from child theme?
- How to display all subpages and short by year
- how to setup custom content structures
- WordPress Filtering Custom Post Type by Metadata and Search Heirachy
- Nested comments in WordPress theme
- Featured Image meta box not showing up
- Why does WordPress append numbers to page slugs sometimes? How to reliably style based on page
- filemtime(): stat failed warning within a child theme
- What are the hooks in WordPress theme development?
- How can I override a require() used in functions.php of parent theme to my child theme
- WordPress dummy data for theme design
- Can I use WooCommerce in a headless CMS setup?
- Dynamic Post Thumbnail →
- How to transfer one domain to another domain without losing theme options (customizer)?
- Do I need to include a textdomain if my theme doesn’t support translation?
- adding class to excerpt
- How to allow users to create their own website within my domain? [closed]
- Problem escaping text which contains html markups
- Avada Child Theme Development
- Editing my theme to try to place the default header at the top of the page breaks the rest of the page content
- WordPress creating images if uploaded image is greater than 960px on one side?
- Create theme for mobile phones and tablets only?
- Using the media library for theme customization
- Changing sidebar.php and footer.php depending on URL
- Seeting Active Nav for Bootstrap in WordPress
- Why does the first page of one category redirect to empty page 4?
- WordPress 6.x / PHP 8.x deprecated warnings in development environment
- Best way to implement bootstrap after loading
- Why front-page.php doesn’t show content of file instead shows loop
- How to Detect “Your homepage displays” setting in wordpress
- Why does wp_customizer default values do not apply when theme is installed for the first time?
- Building a custom menu or use a plugin?
- How Do I Create a WordPress Demo Site with Limited Admin Access
- Importing sass into underscores theme
- Woocommerce REST API for my account & checkout process
- How can I fix my theme header for my CSS stylesheet?
- How to transfer all posts, pages and media
- What are entry.php and its appendix files and is it safe to delete them in a most miniaml site?
- Custom theme vs theme customization?
- WordPress Customizer Help with FontAwesome Icon
- Correct (and secure) way to escape url when using href attribute
- captiva Theme Error
- How to migrate the menu from the site on my own theme in WordPress?
- Why is including all your files within a theme folder important?
- Change default options on attachment page
- FitVid not working for iframes on particular theme install
- How to create multiple sidebar areas with a forloop and register_sidebars?
- Make theme editor to show all theme’s files
- can’t add EVENT LISTENER to a element
- add_action works outside condition but not inside it
- Bootstrap isn’t called into my WordPress theme
- Jquery Ui Tabs not working
- Adding a new layout for genesis
- Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
- custom wordpress theme blog page always not showing the last two pages of the articles
- Cart button not working on mobile version [closed]