By default, snippets run every time your site is visited. If you want a snippet to run only once per day, you can create a cron job. Here's an example: add_action( 'init', function () { $hook =...
By
You can restrict a snippet to only running on one page of your site by adding this line near the top: if ( ! is_page( 'Page Name' ) ) return; You can replace Page Name with the title, slug, or ID...
By
When adding the Global Site Tag (gtag.js) script to your site for Google Analytics tracking, you want to put the tracking code just after the opening <head> tag. You can achieve this using the ...
By
If you want to add Microsoft Clarity tracking to your site, you will be asked to add some code to your site's <head> tag. The easiest way to do this is add a snippet that hooks to the wp_head ...
By
Adding a Facebook Pixel to your site is easy with when using Code Snippets. When setting up the pixel, select Install code manually , and then create a snippet similar to the one below including...
By
Sometimes when you are working with snippets you'll encounter a scenario where you have a value in JavaScript that you want to pass back to a PHP function. One possible solution to this issue is...
By