Copyright © 2026 WPCode. WPCode® is a registered trademark of WPCode, LLC
Documentation, Reference Materials, and Tutorials for WPCode
If you are trying to set up conditional logic rules with a PHP snippet and the conditional logic is not working as intended it’s likely caused by the Auto-Insert location you selected.
The default “Run Everywhere” location for PHP snippets is set up to run very early (using the plugins_loaded hook) for more flexibility on what features you can extend using the WPCode PHP Snippets. Due to these snippets being executed very early, most of the data required for the Conditional Logic rules to work is not yet available so most rules won’t have any effect.
In version 2.0.8 of WPCode we added a new Auto-Insert location for PHP snippets called “Frontend Conditional Logic” which is automatically selected when you enable Conditional Logic (you can always switch back to Run Everywhere).
This new location executes snippets on a hook that runs later (the wp hook), after most of the page data is loaded allowing you to take advantage of all the Conditional Logic rules available in WPCode.
It’s important to note that while this later hook is great for conditional logic it might not be the best one for certain filters or actions that run before it and in that case if you want to limit where your snippet is executed you will have to include those checks in the PHP code.
Future-proof your website with WPCode Snippets and improve the way you manage code across all your websites.
The WordPress® trademark is the intellectual property of the WordPress Foundation. Uses of the WordPress®, names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation. WPCode is not endorsed or owned by, or affiliated with, the WordPress Foundation.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Websites store cookies to enhance functionality and personalise your experience. You can manage your preferences, but blocking some cookies may impact site performance and services.
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Stripe is a payment processing platform that enables businesses to accept online payments securely and efficiently.
Service URL: stripe.com (opens in a new window)
WooCommerce is a customizable eCommerce platform for building online stores using WordPress.
WPForms is a user-friendly WordPress plugin for creating custom forms with drag-and-drop functionality.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Convert Insights offers data-driven analysis to optimize your marketing strategies and enhance customer engagement.
Service URL: www.convert.com (opens in a new window)
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: business.safety.google (opens in a new window)
Clarity is a web analytics service that tracks and reports website traffic.
Service URL: clarity.microsoft.com (opens in a new window)
Marketing cookies are used to follow visitors to websites. The intention is to show ads that are relevant and engaging to the individual user.
OptinMonster is a powerful lead generation tool that helps businesses convert visitors into subscribers and customers.
Service URL: optinmonster.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.