wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Add plugin settings link to plugins list table

wordpress snippet

When building a plugin that has its own settings page, it’s often handy to create a link to the settings page straight from the Plugins page in the dashboard – this saves users the time it takes to find where exactly your plugin appears in the admin menu. Here is a simple code snippet that creates the settings link for you – all you need to do is set the link to point to the right place. This code must be placed in your plugin’s index file.

read more

Adjust settings on theme activation

wordpress snippet

Place this in your functions.php to adjust your default WordPress settings when activating your theme for the first time. This function also deletes the default post, page and comment that are created when you install WordPress.

read more

Reset options back to default with update_option

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will check if an option was updated by a user. If so, it will save it back to the default option you’ve set. Should work with almost any site option. (inspect element on input field and input’s “id” should be the “name” you need.)

read more

Reset blog back to default settings

wordpress snippet

This snippet will reset wordpress back to the default settings. WARNING please use with care Place this snippet into the functions.php of your wordpress theme and be sure to remove it after settings are reset.

read more

Restore default settings

wordpress snippet

Adding this to your functions.php will restore the default setting for wordpress.

read more

Add admin add_options_page link to all settings in wordpress

wordpress snippet

This snippets provides access to options.php that has an alphabetized listing of all the options stored in your wp_options database table. Some of the options are not editable however you can change most anything. You will need to add this snippet to the funtions.php of your wordpress theme.

read more