Hide WordPress Plugins

Have you ever wanted to hide a plugin from the list of plugins in the WordPress admin? You may want to hide a plugin so the client doesn’t accidentally deactivate or delete it. Or maybe it’s just a utility plugin the a client doesn’t need to see or mess with the settings of. The code snippet below will completely hide a plugin from WordPress plugins list on the Admin side.

Remove Dashboard Widgets

Are you wanting to to remove the default meta boxes from the WordPress Dashboard or remove meta boxes from particular posts or pages. the WordPress functions below will do just that for you. Simply copy and paste the code below into you functions.php file located in your theme folder. Then make sure to customize the function as you see need.

Custom Database Queries

If you need something more than what the default WordPress functions give you, you can use $wpdb, the WordPress database class to query the database directly. [php] $recent_users = $wpdb->get_results( "SELECT display_name, user_registered FROM $wpdb->users ORDER BY user_registered DESC LIMIT 0,10" ); [/php]

Custom Profile Fields

I can’t say that WordPress offers much in the way of profile customization in the administration area. Especially nowadays, when you want to show the Twitter and other social accounts of authors, this is a shortcoming. It can be fixed easily, though.

Twitter-Like Time Display

This is a fantastic function, especially since it has been in WordPress since version 1.5! If you want to display a relative date in a human-readable format, like “5 minutes ago” or “one month ago,” try the human_timed_diff() function. Example 1 [php] $diff = human_time_diff( ‘2012-05-05 12:05:00’, ‘2012-05-05 12:10:00’ ); echo ‘This comment was submitted  … read more

Upload Files With Ease

WordPress has a bunch of great uploading functions for everything from checking the file type to finding the uploads directory. A more obscure function is wp_upload_bits(), which you can use to upload a file to the uploads directory. [php] $upload = wp_upload_bits( $_FILES[‘myfile’][‘name’], null, file_get_contents( $_FILES[‘myfile’][‘tmp_name’] ) ); echo ‘Well uploaded! The path to this  … read more

List all hooked WordPress functions

WordPress hooks are very useful because they allow you to “surcharge” an existing WP function with your own code. But when things goes wrong, it should be useful to be able to list all hooked WordPress functions. Here is the code to it. The first thing to do is to paste the following function in  … read more

Register a New WP Role

Create Custom Roles for Your Website A Role defines a set of tasks a user assigned the role is allowed to perform. For instance, the Super Admin role encompasses every possible task that can be performed within a Network of virtual WordPress sites. The Administrator role limits the allowed tasks only to those which affect  … read more

Register Custom Image Sizes

Custom image sizes are almost a must when developing a website for a client. If you create customize sizes for your clients website you can ensure that when the client adds an image to a post it will be the correct size on the front-end, helping resolve broken layout issues I have seen many, many times.