21 WordPress Interview Questions and Answer for interview

21 WordPress Interview Questions and Answers (II) for Experienced

Q1.         What are hooks and define types of hooks in WordPress?

Ans.       Hooks are provided by WordPress to allow your plugin to ‘hook into’ the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion. There are two kinds of hooks:

Actions Hooks: Actions hooks are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions which are executed at these points, using the Action API.

Filters Hooks: Filters hooks are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions which are executed to modify specific types of text at these times, using the Filter API.

Actions Functions:

Filter Functions:

Q2.         What are the template tags in WordPress?

Ans.       A template tag is code that instructs WordPress to “do” or “get” something. Like in header.php  we will use the tag bloginfo(‘name’) to get “Site Title” from wp-options table which is set in Setting > General at WordPress dashboard.

The the_title() template tag is used to display the post title.

wp_list_cats() is  for display categories.

get_header() for getting header.

get_sidebar() for display the sidebar on page.

get_footer() for get the footer content on page.

Q3.         how to write the short code in WordPress php file?

Ans.       Using do_shortcode() function inside of php echo tag. A very simple solution is to use the do_shortcode() function inside a PHP echo tag.

<?php do_shortcode(“[shortcode]”); ?>

Q4.         What are rules to follow in WordPress plugin development?


  • Find a unique name
  • Setup a prefix (related to your brand)
  • Create the plugin’s folder
  • Create sub-folders for PHP files, assets, and translations
  • Create the main plugin file and fill in obligatory header information
  • Create a readme.txt file
  • Use proper constants and functions to detect paths to plugin files
  • Create additional PHP files and include them inside the main one
  • Create activation and deactivation functions
  • Create an uninstall script

Q5.         What are the steps you can take if your WordPress file is hacked?


  • Install security plugin like WP security
  • Re-install the latest version of WordPress
  • Change password and user-ids for all your users
  • Check your themes and plugins are up to date

Q6.         In which cases you don’t see plugin menu?

Ans.       You can’t see your plugin menu when the blog is hosted on free wordpress.com as you cannot add plugin there.  Also, if you do not have an account of an administrator level on your WordPress dashboard, it is not possible to see plugin.

Q7.         What is the difference between the wp_title and the_title tags?

Ans.       wp_title() function is for use outside “The Loop” to display the title of a Page.  the_title() on the other hand is used within “The Loop“.

Q8.         How to modify the parent theme behavior within the child theme?

Ans.       The child theme could optionally override other template files like author.phpcategory.phpfunctions.phpstyle.css etc. The WordPress framework first looks for a template file in the child theme directory and then will pick it up from the parent directory if not found.

Q9.         How to Create Custom Post Type?

Ans.       Custom post types are new post types you can create. A custom post type can be added to WordPress via the register_post_type() function. This function allows you to define a new post type by its labels, supported features, availability and other specifics.

Here’s a basic example of adding a custom post type:

Custom Post Type

Q10.       How to check if a page exists by url?

Ans.       You can use get_page_by_path() function. Refer check page existance by url detailed article.

Q11.       What do next_posts_link() and previous_posts_link() do?

Ans.        Because post queries are usually sorted in reverse chronological order, next_posts_link() usually points to older entries (toward the end of the set) and previous_posts_link() usually points to newer entries (toward the beginning of the set).

Q12.       How to create mailchimp or vertical response campaign for newsletter subscribers & link with WordPress ?

Ans.       First Create List & Campaign on mailchimp/ WordPress account . Then subscribe users from WordPress in mailchimp list by plugin or  manual hard code webform.

Q13.       What options are there to implement a multi language site ?

Ans.       WordPress has no bi/multi-language feature built in by default. The other road would be to extend the site with Add-ons like plugins and themes that have multi-language features built-in.

Q14.       How will you retrieve adjacent posts (next/previous) within the same category?

Ans.       We can retrieve previous post using get_adjacent_post() function and providing it ‘true‘ and taxonomy name in first and last parameters respectively. Setting third parameter to false will bring next adjacent post in front of you.

Q15.       How to create Custom Taxonomy specific to a Custom Post type?

Ans.       First of all if you want to show taxonomy metabox only to custom post type then register the taxonomy to only that custom post type by passing the custom post type name as argument in register_taxonomy(). By doing this the taxonomy metabox appears only to custom post type.

Q16.       How can I stop WordPress from prompting me to enter FTP information when doing updates?

Ans.       If you edit your wp-config.php file you can preload these FTP settings as constants read by WordPress. Keep in mind, on a shared host, you should be mindful of possible security implications.

Q17.       How To Activate Plugins via Code?

Ans.       Plugins are stored in an array in the ‘active_plugins‘ option. The array contains the file path to each plugin that is active. To activate a plugin you need to determine what it’s path will be, then pass that path to activate_plugin($plugin_path).

Before you can call activate_plugin() you need to include the plugin.php file from wp-admin/includes/. You should also check to make sure your plugin isn’t already active. The result looks something like this:

Activate Plugins via Code

Q18.       What’s the difference between site_url() and home_url()?

Ans.       The site_url() will always be the location where you can reach the site by tacking on /wp-admin on the end, while home_url() would not reliably be this location. The home_url() would be where you have set your homepage by setting General > Settings “Site Address (URL)” field.

Q19.       How to Link External jQuery/Javascript files with WordPress

Ans.      Add your own scripts via wp_enqueue_script() in your template’s functions.php, appropriately setting dependences on jQuery, and wp_head()will add the scripts for you.

Q20.       How to set global variable in functions.php

Ans.       Pure PHP question, really.

If you declare the variable with the ‘global‘ keyword when you initialize it, it will be available thereafter.

Q21.       How to retrieve an image attachment’s alt text?

Ans.       The wp_get_attachment_image() function which will return an HTML string containing these attributes:

  • src
  • class
  • alt
  • title‘.

SEE Also:


PDO :: prepare


PHP: PDOException

PDO :: quote

PDO :: rollBack

PDO :: setAttribute

WordPress Plugins

WordPress Features


15 thoughts on “21 WordPress Interview Questions and Answer for interview

Leave a Reply

Leave a Reply

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