WordPress Interview Questions and Answers – Part 12

151. How to check if any plugin is active in WordPress?
With the method is_plugin_active() we can check any particular plugin is active or not.
How to check

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

if ( is_plugin_active( 'plugin-directory/plugin-file.php' ) ) {
   // Activated

152. How to display menu in WordPress?
After registering your menus, use wp_nav_menu() to inform your theme where to display your menus. You can add this code to a header.php file for displaying the registered header-menu:

wp_nav_menu( array( 'theme_location' => 'header-menu' ) );


wp_nav_menu( array $args = array(

   'menu' => "",

   'menu_class' => "",

   'menu_id' => "",

   'container' => "",

   'container_class' => "",

   'container_id' => "",

   'fallback_cb' => "",

   'before' => "",

   'after' => "",

   'link_before' => "",

   'link_after' => "",

   'echo' => "",

   'depth' => "",

   'walker' => "",

   'theme_location' => "",

   'items_wrap' => "",

   'item_spacing' => "",

) );

// These are the parameters od this function.

153. At what instance you get locked out of your WordPress admin and look at your website as a blank screen?
This would likely happen when you have pasted the code from a website with wrong formats, also when you have pasted the code in an incorrect location. It may also happen when your IP is banned

154. Where is WordPress content stored?
WordPress contents are stored in MySQL database on Server.

155. How do I edit the contents of a page in WordPress?
• Login to WordPress admin area
• If editing a Post, Click “Post” and then click “All Posts.” Find the Post you want to edit and make changes. Click Publish.
• If editing a page, Click “Pages” in left column menu, and click “All Pages.” Find the page you want to update and make changes. Click Publish.

156. What are WordPress hooks?
It is provided by WordPress to allow your plugin to ‘ hook into’ the whole WordPress; that is, to call functions in the plugin at particular times according to your need and thereby set your plugin in motion.

157. What are the difference between action hook and filter in WordPress?
1. Actions Hook
Actions Hook are triggered by particular events that take place in WordPress such as changing themes, publishing a post, or displaying an administration screen. It is a custom PHP function defined in your plugin and hooked, i.e., set to respond, to some of these events.
Actions offently do one or more of the following things
• Modify database data
• Send an email message
• Modify the generated administration screen or front end page sent to a user web browser.
Here are some Actions Functions listed
• has_action()
• do_action()
• add_action()
• remove_action() etc
2. Filters Hook
Filters Hook are functions that WordPress passes data through, at certain points in execution, just before taking some action with the data. It sits between the database and the browser and between the browser and the database; all most all input and output in WordPress pass through at least one filter hook.
The necessary steps to add your filters to WordPress are listed:
• Create the PHP function that filters the data
• Hook to the screen in WordPress, by calling add_filter()
• Put your PHP function in a plugin file and activate it.
Here are some Filters Functions listed
• has_filter()
• doing_filter()
• add_filter()
• remove_filter() etc

158. What is shortcode in WordPress? How we can use it?
Shortcodes in WordPress are specific codes that allow the developers to do various tasks with minimal effort. Shortcodes are used to simplify tasks such as creating objects or embedding files that require lots of coding in a single line. A Shortcode is synonymous to the shortcut. WordPress has five built-in shortcodes- audio, embed, caption, video, and gallery.
1. You can call shortcode function like this :

echo do_shortcode('[display_related_posts]');

2. In your function.php you can make

function display_related_posts($array = array()) {
return 'BestInterviewQuestion.com';

add_shortcode('display_related_posts', 'display_related_posts');

159. What is wp_footer() in WordPress?
It is a type of action hook where the code is dynamically added to a theme in between footer tag. With the help of these functions, we can insert plugins additional code into footer tag.


<?php wp_footer(); ?>


160. How to add custom dynamic sidebars in WordPress?
A Sidebar in WordPress is an area where widgets can be used with a theme and this area is also termed as a Widgetized area. In WordPress, sidebar is created by using a function named as register_sidebar() function. The widget zed area should be registered in WordPress supported the theme as they are presentational. The sidebar function takes only one argument of an associative array of parameters that set the options for the widget area. Wrap $args array and register_sidebar() both are separate functions that can be called on ‘widgets_init’ hooks. In short, with the use of register_sidebar() method/ function users can add sidebars to WordPress. Syntax code for the creation of sidebar-

$args = array(
'name' => __( 'Sidebar name', 'theme_text_domain' ),
'id' => 'unique-sidebar-id',
'description' => '',
'class' => '', 'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>'

161. How to Create a Widget in WordPress?
Widget is defined as a configurable code snippet which makes it possible to customize the functionality and appearance of a WordPress blog. Users can access the widgets page form the appearance menu effectively. Widgets in WordPress allow you to drag and drop the elements into the sidebar of your website. WordPress is featured with a standard set of widgets that you can use with any theme of WordPress. In order to create a customer widget in WordPress, it is important for the customers.
• In order to create a site-specific plugin, paste the code functions .php file (theme’s file)
• add your code to appearance >> widgets pages
• register with ‘wpb_widget’ and load customer widgets

162. How do you enable debug mode in WP?
You can enable debug mode in WP by editing wp-config.php file and changing WP_DEBUG constant value to true

163. What is a WordPress taxonomy?
In WordPress, a “taxonomy” is a grouping mechanism for some posts (or links or custom post types). There are four default taxonomies in WordPress they are
• Category
• Tag
• Link Category
• Post Formats
You are also free to create your custom taxonomies too.

164. How to secure in our WordPress site?
Here are some practical ways:
• Use a unique username and password
• Use precautions against Brute force
• Keep the versions, plugins, and themes updated.
• Prevent from viruses and malware.
• Also you can use wordpress security plugins

165. How to change the homepage URL in WordPress?
Here are the steps to successfully change the Homepage URL in WordPress. Go to the function.php file in your WP theme and use this code:

function redirect_homepage() {
if( ! is_home() && ! is_front_page() )
wp_redirect( 'http://siteurl.com/news', 301 );
add_action( 'template_redirect', 'redirect_homepage' );

166. How we can change table prefix ( wp_ ) in WordPress?
We can do it 2 ways
• Before installation : Go to wp_config.php file and rename $table_prefix = ‘wp_’; whatever you want.
• After installation : Go to phpmyadmin -> select your databse -> check all tables -> Add/Update table prefix.

167. How do I update my wordpress website?
There are two ways to update your WordPress – one-click update and manual update.
1. One-click update
All versions of WordPress from 2.7 onwards have this feature. You can update by going to the Dashboard and clicking “Updates” screen. On “Update WordPress,” click “Update Now” for initiating the process.
2. Manual Update
• Replace your WordPress files
• Download and unpack the latest zip file.
• Deactivate plugins and delete old wp-includes and wp-admin directories on your host.
• Using FTP, upload new wp-includes and wp-admin directories.
• Upload individual files from a new wp-content folder, and overwrite existing files. Do NOT delete existing wp-content folder or files and folders in the current wp-content directory.
• Next, upload new files from the root directory of the latest version to your current directory.

168. What are disadvantages of WordPress?
Use of multiple plugins can make website heavy to load and slow
• Only utilizes PHP
• Sometimes updates can lead to loss of data, so you always need a backup copy
• Modifying images and tables are difficult.

169. How to take backup of our WordPress website?
There are three ways to back up a WordPress website thoroughly.
1. Backup Through Hosting
Hosting providers offer service that completes daily, complete backups to your WordPress website.
2. Backup Files Manually
We have to download the entire WordPress directory via cPanel or SFTP program. We can also use WordPress database to backup website data manually.
3. Automated Backup with Plugins
There are many secure and easy to use WordPress backup plugins available for your use. Just install, configure few settings and you are ready to go. Few of them are: BackupBuddy Premium, BackWPup Free WordPress Plugin, Duplicator Free WordPress Plugin, UpdraftPlus Backup and Restoration Free WordPress Plugin, WordPress Backup to Dropbox Free WordPress Plugin, etc.

170. What is theme?
A theme in WordPress is a collection of files that work together to produce a graphical interface with an underlying unifying design for web pages. These files are called template files and theme modifies the way the site is displayed, without changing the core files. It includes image files, customized template files, style sheets, custom Pages. etc
Themes are located in the Administration Screen > Appearance > Themes as additional selections.

171. What are the steps to install WordPress theme?
Here are the steps:
• In login dashboard, click “Appearance” “Theme” and “Add New.”
• On the top of your screen, click “Upload.” Click “Browse,” and select.ZIP file for a downloaded extension.

172. What is the difference between installing and activating a theme?
When a theme is activated it’s what’s controlling your site, while an installed theme is simply part of your theme library and available to activate.

173. What is Customize theme?
Customizing themes helps you to give a new look to your website. Here you can change background images/colors, add titles, and do much more.

174. What is config file in WordPress?
wp-config.php is the most important file in WordPress installation. It links the database and files on your WordPress site together. Located in the root of WordPress file directory, wp-config.php contains configuration details, including database connection information.

175. Which ‘meta box’ is not hidden by default on Post and Page screens?
Featured Image is the meta box that is not hidden by default on Post and Page screens.

176. What is the use of WordPress General Setting?
WordPress general setting is used to set the basic configuration settings for your site.

177. What is the difference between the two URLs in General Settings? (Hint: WordPress Address AND Site Address).
The WordPress Address is where to look for WordPress files, while the Site Address is what will be used as the base for creating URLs for web pages.

178. What are Importers in WordPress?
In WordPress, Importers are plugins that provide the functionality to import a bulk XML file with any number of records. It enables to import Posts, Page, Custom Posts and Users data in an XML file.
Using WordPress importer, you can migrate different data like:
• New Posts, pages, or other custom created post types
• Comments in posts
• Custom fields and post metadata
• Categories, tags, and other terms from custom taxonomies section
• Authors on the website

179. List some action and filter hooks functions in WordPress?
Below are list of some Filter hooks functions
• has_filter()
• add_filter()
• apply_filters()
• apply_filters_ref_array()
• current_filter()
• remove_filter()
• remove_all_filters()
• doing_filter()
Below are list of some Action hooks functions
• has_action()
• add_action()
• do_action()
• do_action_ref_array()
• did_action()
• remove_action()
• remove_all_actions()
• doing_action()

180. What is wp_enqueue_script() function in WordPress?
In order to include JavaScript file in WordPress, a special function can be used namely wp_enqueue_script (). In WordPress, the preliminary goal of wp_enqueue_script () is to add a JavaScript file which is one of the WordPress action hooks. In order to use the wp_enqueue_script (), users should need to add JavaScript to each page on the WordPress site.

181. Function to get website url in wordpress?
get_site_url(); function is used to get website url in wordpress.

182. What is wp_head() in WordPress?
It is a type of action hook where the code is dynamically added to a theme in between head tag.


<?php wp_head(); ?>

183. How to display an image URL from thumbnail in WordPress?
You we use get_the_post_thumbnail_url(); . You can use this inside loop or outside loop. If you are using this outside of loop then you have to pass post ID otherwise its optional in case inside loop.

184. How to check a featured image exists or not in WordPress?
We can use has_post_thumbnail() method to check the featured image is exists or not.

if ( has_post_thumbnail() ) {



185. How to add your custom image size for the featured image in WordPress?
The following steps need to use in order to customize image sizes in the CSM WordPress. Edit your existing theme’s funcation.php file and add the following code add_image_size( ‘image_size_name’, 1000, 590 );

186. How will you display error messages during development in WordPress?
To display error messages in WordPress. Open WordPress wp-cofig.php file and change WP_DEBUG constant value to true
In WordPress, WP_DEBUG is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout the website.

187. Mention the rules to be followed while developing the WordPress Plugin?
While developing a WordPress Plugin, the following rules should be followed step by step:
• Create a unique name.
• Create the folder of Plugin.
• Create a sub-folder for PHP files, translations, and assets.
• Create the main plug-in file and fill up the header information.
• Create activation and de-activation functions.
• Create an uninstall script.
• Create a readme.txt file.
• In case of detecting the paths to plug-in file, use proper functions and constants.

188. Is wordpress.com more secure than wordpress.org?
Yes, wordPress.com is considered to be more secure than WordPress.org because it limits the themes and does not allow the installation of plugins. But, the security is, however, more dependable on how your website is hosted by the hosting company and also the steps they take to prevent the security problems.

189. How to make any others pages to front page in WordPress?
To make your static page as a front page you have to follow these steps
• Goto Admin Panel
• Select “A Static Page”
• Choose you page from “Front page” section
• Now your selected page from Front Page is set default front page.

190. How can you display a list of child pages in WordPress?
We can use simplay WP_Query() with post_parent and post_type, then we can get all child pages of that particular parent page.

$my_query = new WP_Query(array(

'order' => 'ASC',

'orderby' => 'menu_order',

'post_parent' => 13,

'post_type' => 'page',






// display your required things



191. Why WordPress is the best CMS?
WordPress is the best CMS in the world because of its features and advantages. It offers an open source environment which makes it completely free to manage and install.
There are many reasons why WordPress is considered the best CMS. Some of them are listed below:
• Available huge Themes and Plugins
• SEO Friendliness and Security
• Open source and Free of Cost
• A large community of developers and users
• Inbuilt Admin User Interface and its Speed

192. What is Category in WordPress?
A category is one of the predefined taxonomies in WordPress, and it is used to sort and group content into different sections. In new WordPress installation, “Uncategorized” is the default category. We can change the default category from Settings -> Writing screen. In WordPress post can be filed under many categories and can have both tags and categories.
For Example

wordpress category

193. What is Tag in WordPress? Explain
A tag is one of the pre-defined taxonomy in WordPress. You can add tags to posts along with categories in WordPress. Tags are smaller in scope and focused on specific topics.

194. Where do I insert Google Analytics code in WordPress?
While there are different ways to add Google Analytics your WordPress site, here are the 3 most common ones:
• Through MonsterInsights
• By inserting plugins for Headers and Footers
• By installing Google Analytics in the WordPress Theme
195. What are the difference between Tag & Category in WordPress?

wordpress tag & category difference

In WordPress categories are hierarchical which means terms can have a relationship with each other like child and parent.
Example: You could have a Category called India, and under India, you could have categories called Delhi, Haryana, and U.P. Categories means for broad grouping of posts.
But Tags are NOT hierarchical which means no relationship between them. Tags means to describe specific details posts.
196. How safe is your website on WordPress?
WordPress is safe to operate, but it is suggested to keep yourself updated with the latest version of WordPress in order to avoid hacking.

197. What is usermeta function in WordPress?
The user metafunction is used to retrieve the metadata of users. It can return a single value or an array of metadata.
Syntax is: get_user_meta( int $user_id, string $key = ”, bool $single = false )
User id is the required user id parameter
Key is the optional parameter which is the meta key to retrieve. By default, it returns data for all key values.
Single is an optional parameter that tells whether the single value will return. By default, it is false.

198. Explain Avatar in WordPress?
Avatar or Gravatar is an icon or representation of a user in a shared virtual reality, such as chat, forum, website or any other form of online community in which the user wants to have something to distinguish themselves from other users.
It usually an 80px by 80px image that the user will create by ownself.

199. How to display custom Post in WordPress?

$args = array( 'post_type' => 'blog', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="entry-content">';
echo '</div>';

200. How to create custom Post In WordPress?
Custom posts types in WordPress are the new post types that developers can create. You can add a custom post type via the register_post_type() function, which allows the developers to define the new post type by labels, features, and availability.
Or we can also create custom post type with the helps of plugins.
• Custom Post Type UI
• Custom Field

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + two =

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter