Web & Software Developer

Archive for “WordPress Code Snippets”

WordPress tutorials, help, and code snippets to help you design and customize your own WordPress site.

Show WP Admin Notice With Pure JavaScript

This adds a dismissible admin notice to the WP admin with pure JavaScript. No jQuery or other dependencies. The admin notice will have a Dismiss icon just like the regular WP admin notices. When the icon is clicked, the message will go away. This admin notice will have a blue left border which is given … Read more →

Run Code Only Once in WordPress

You may have a function or some code that you only want to run one time on your WordPress site. You may notice that functions hooked on to admin_init can be fired twice. Here is quick way to run your code only once. This will guarantee that it runs one, and only one, time. Mandatory … Read more →