Introducing the WPCodeBox Condition Builder

The WPCodeBox condition builder makes it even easier to control when WordPress Code Snippets are executed.


I'm excited to announce the release of a new WordPress code snippet feature that many WordPress users have been asking for: the condition builder! The condition builder allows you to add conditions and actions to your WordPress snippets so they execute only when certain criteria are met. For example, if you want an action on a snippet to trigger only when someone is logged in then set "logged_in" as one of your conditions.

The condition builder makes it super easy to select under what circumstances a snippet would be executed. The conditions can be combined into groups and separated with AND/OR logic, so the only limit to what you can build is your imagination.

The available condition building blocks

Location (Frontend/Admin)
This is useful when you want a WordPress code snippet to run only on the Frontend or WP Admin area.

Current Post
This will allow you to select one or more posts on which you want the code snippet to run or not run.

Current Post Type
You can use this to make a snippet run only on a certain post type (Only on a page or a post, or a product)

Current Post Parent
The snippet will run only if the current post is the child of the selected posts.

Taxonomy
This is super useful to run snippets on posts that contain only certain taxonomies, like grouped products, or only on posts that belong to a certain category.

Custom PHP Condition
This makes it super easy to write custom PHP conditions to determine if a snippet should or should not run. The PHP condition editor has WordPress aware autocomplete and it will suggest all the WordPress Conditional Tags.

Page URL
Using this condition you can run or not run a snippet based if the page URL contains or doesn't contain a certain string. This is useful for example when you don't want to run a WordPress code snippet in the Oxygen Editor context.

Current Logged In User
This will only run/not run a snippet if the currently logged-in user is the selected one.

Time
This helps time snippets to run only between certain times, for example, if you want to show a banner with a promotion only during a certain period.

Day Of Week
This is like the time condition, but it allows to run Code Snippets on certain days of the week.

Conclusion

WordPress snippets are a powerful WordPress feature that can save you time and money. The condition builder makes WordPress code snippets even more versatile by giving them the ability to execute only when certain criteria are met, like whether someone is logged in or if they're on the admin dashboard. For example, if your goal was to show an offer for new customers only when they've been added as followers of your blog then set "logged_in AND follower" as one of your WordPress snippet conditions. If WordPress code snippets sound interesting but complicated don't worry! Our team at WPCodeBox has got you covered with our intuitive interface and extensive documentation so that anyone can create WordPress codes without any coding knowledge whatsoever!

Get WPCodeBox, the most powerful WordPress Code Snippet Manager.

and save hours when customizing WordPress sites.

NWPCodeBox
WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.

Free Tools

Product

Legal

Follow us
Copyright © 2024 WPCodeBox SRL