Skip to main content

Advanced Condition for Running Snippet

Add condition for load/running snippet:

In case PHP snippet:

  • Run everywhere

  • Only admin/Front-end

  • Front end with condition, example only for category/post/pages/404-page,..

  • Admin with condition, example for widget.php, tool.php, edit.php,.. or for specific admin url. Or only admin_footer/header

  • Schedule snippet, only run in range of time.

For all type of snippet:

  • Only run if user meta key match some value

  • Only run if user role is…

  • Use the page referrer/last visited page url as a condition.

  • Load this snippet based on another snippet being loaded.

Status: Completed2 comments

Log in to comment and vote

Comments2

  • ainom

    •

    Mar 10, 2025

    Or if page URL contains a specific string

  • ainom

    •

    Mar 10, 2025

    Or only load snippet on specific pages/posts, or specific post or custom post types Must also have logical AND/OR operators for different conditions.