Have you ever needed to execute a code snippet only once?
If you answered yes, then this update is particularly special for you! WPCode v2.1.12 brings enhanced control and efficiency over PHP code snippets.
You now have the ability to execute code snippets on demand or programmatically just when you need it.
Here’s what it means for you in detail.
Introducing On-Demand Execution For PHP Code Snippets
Imagine being able to update user roles, perform database maintenance, or execute custom scripts with just a click—this is the power and convenience that the new “On Demand” insertion brings.
This feature allows you to run PHP scripts exactly when you need them, providing a practical solution for operations that require manual initiation.
You can programmatically control when to run a snippet and how many times you want it executed. This new ability also broadens the scope for integration and interaction between multiple snippets.
The “On Demand” insertion location is available for both free and premium WPCode users. From the snippet editor, visit Insertion > Location >, and you’ll find “On Demand” in the list. When selected, a new Execute Snippet Now button will appear at the top next to the Update/Save Snippet button.
Visit the documentation for more information on how to use the “On Demand” location.
New Smart Tag For Permalink Management
Imagine you want to create a custom footer snippet that includes a “Bookmark this page” link. You can do that by using the Permalink Smart Tag, the URL for the bookmark link will automatically adjust to reflect the permalink of the page on which the footer appears.
The smart tag for permalink allows you to manage and reference permalinks more effectively within your snippets, enhancing your site’s SEO and navigation capabilities. You’ll find the permalink smart tag in the WPCode Page Scripts metabox in the page-specific scripts. You can also use the {permalink}
smart tag in Code Snippets.
Visit the documentation for more information on how to use the Smart Tags.
Summing Up
This update empowers you with more precise control over how and when PHP snippets are executed on your WordPress site. We can’t wait to see how the “On Demand” location and permalink smart tag enhance your snippet management capabilities.
Upgrade WPCode today to get more advanced controls that make your life easier!