wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

count_user_posts by user ID and by post_type

wordpress snippet

You may be aware that count_user_posts has been around since about 3.0. However as of 4.1 you are able to optionally define a post_type. This is a perfect little snippet if you have a blog with multiple post types and you wanted to show specific counts for authors. I could use something like this for WordPress snippets vs tutorials sections and it would be perfect. Just add this snippet in the template you wish to display the count and you are ready to go.

read more

Track post and page views by user ID, date and time

wordpress snippet

After an interesting conversation with a fan of wpsnipp, I come up with something to track unique post views for registered users. However this neat little snippet does a little more than that. First add wps_trackViewDates(); within the loop of your single.php template file. Once this has been added, the snippet will track the ID of the user that viewed an individual post along with the date and time it was viewed.

read more

Redirect a successful registration to specific page

wordpress snippet

When you allow user registration on our wordpress site you may want to add something extra. Interested in thanking people after they register or just send them to a specific page for newly registered members.

read more

Give author capabilities including editing other authors posts

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow authors to edit other users posts.

read more

Remove admin color scheme options from user profile

wordpress snippet

This is an alternative method to the one I posted some time ago, “Remove admin color scheme picker from profile” Adding this snippet to the functions.php of your wordpress theme will remove the admin color scheme from the user profile.

read more

Send email notification when profile updates

wordpress snippet

I got a few emails asking about sending an email when a user simply updates the profile. Well here it is, adding this snippet to the functions.php of your wordpress theme will send an email notification to the user when the user profile updates.

read more