Add an Admin User in WordPress

Převzatý článek

If you have forgotten your WordPress password and email, then you can add an admin user by adding this code to your theme’s functions file using an FTP client.

Don’t forget to fill in the username, password, and email fields. Once you login to your WordPress site, don’t forget to delete the code from your functions file.

For more on this topic, take a look at our tutorial on how to add an admin user in WordPress using FTP.

How to add .pdf support to the WordPress media manager

Převzatý článek

By default, the built-in WordPress media manager allows you to filter media by three types: images, audio and video. But if you work a lot with .pdf files, you may need to add an option to filter .pdf files from the media manager. Here is a simple code snippet to do it.
Paste this code into your functions.php file. Save the file, and you’re done.

Note that this code snippet can be used for other file types as well as .swf, .avi, .mov, etc.

How to disable RSS feeds on your WordPress blog

Převzatý článek

WordPress built-in RSS feeds are definitely cool. But if you’re using WordPress to create a simple website, you may do not need the feeds at all. So what about disabling them? Here’s a simple and clean way to do it.
Paste the code below into your functions.php file. RSS feeds will not be available anymore after you saved the file.


How to detect a comments page on your WordPress blog

Převzatý článek

On WordPress dashboard, there’s an option to divide comments lists in sub pages. Unfortunately, there’s no built-in conditional tag to know if you’re currently on a comment page. So let’s built one!
Simply put the following code anywhere on your theme files. If you’re on a comment page, the conditional statement will return true, so any code within brackets will be executed.

This code works on posts, pages, attachments as well as all custom post_types.

WordPress snippet: breadcrumb without plugin

Převzatý článek

If you want to add a breadcrumb to your blog, you can use one of the many available plugins to do so. But why using a plugin when you can easily code it yourself? Here’s a ready to use code snippet to add a breadcrumb to your WordPress blog.
Open your functions.php and paste the code below in it:

Once done, open header.php and call the function:


WordPress tip: Modify any role name to fit your needs

Převzatý článek

Have you ever wanted to change the default role names (Administrator, Editor, Author, Contributor, Subscriber) within WordPress? Here is a super useful snippet to do so.
Simply paste this code into your function.php file. Edit lines 5 and 6 at your convenience.