WordPress Useful Codes

As we know that wordPress provides a lot of predefined functions which we can use to get our work done easily. In our today’s post, we will get all those WordPress Useful Codes together so that anyone can use these codes anytime at the time of development. Generally, we don’t remember the function name exactly and due to that, we have to google that. Sometimes we get the correct result in out search but sometimes it takes a lot of time to search things. I had tried to provide all the daily use code by developer in one post. You can use the code anywhere in your project. Lets have the list of codes with some description:

1. Get all users with role ‘Administrator’

Some wordpress useful codes and posts link

2. Wordpress Useful Codes - Display only authors

OR

3. Disable plugin update for a specific plugin only

Although there can be many ways to do this but I am giving away two of them

Way 1 : Add this code in your plugin root file:

Way 2: Adding code to theme’s functions.php

Note : wp-faker is the name of  folder and wp-faker.php is the root file name of plugin.

4. Show errors:

Scenario 1: Show errors on specific page:

Add the following code at the top of file for which you want to enable error display

Scenario 2: show errors Globally on all wordpress pages:

Update the following code inside wp-config.php file

 

Loading