WordPress Interview Questions: WordPress is a free and open-source content management system based on PHP and MySQL.
Q: What is WordPress?
Ans: WordPress is an online, open source website creation tool written in PHP. But in non-geek speak, it's probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.
Q: How many tables default WordPress have? Can you name those default WordPress table?
Ans: The default version of WordPress is incorporated with 11 tables with previous version. They are:
  1. wp_options
  2. wp_users
  3. wp_links
  4. wp_commentmeta
  5. wp_term_relationships
  6. wp_postmeta
  7. wp_posts
  8. wp_term_taxonomy
  9. wp_usermeta
  10. wp_terms
  11. wp_comments
But in New version as of 4.5.3 there are 12 default tables which are:
  1. wp_commentmeta
  2. wp_comments
  3. wp_links
  4. wp_options
  5. wp_postmeta
  6. wp_posts
  7. wp_termmeta
  8. wp_terms
  9. wp_term_relationships
  10. wp_term_taxonomy
  11. wp_usermeta
  12. wp_users
Note: wp_termmeta is newly added.
Q: Tell me is a web site on WordPress secure?
Ans: Yes! A WordPress Website is completely secure from any unauthorized access. However, the error may occur due to downloading the Plug-in and Tools from an unauthorized resource. Note: Now various Plugins are available for security like Limit Login Attempts etc.
Q: What is the procedure to call a constructor for a parent class?
Ans: The command to call a constructor for a parent class is parent::constructor($value);
Q: Can you answer that whether objects are passed by value or by reference?
Ans: All the objects are passed by Value.
Q: What is the limitation to the depth of your categories?
Ans: There is no limitation level to the depth.
Q: Can you override database values for your sit URLs in wp-config.php?
Ans: Yes, overriding of database values is possible.
Q: Is WordPress good for Google ranking and SEO?
Ans: Yes! WordPress was born with one of the key features to drive the traffic called built-in SEO and it is the most considered point along with other features in this technology, which makes it popular worldwide.

Search engine optimization is considered the best selling point of WordPress to boost the traffic over the web or in other words Google ranking. Although there are multiple CMSs, they require an installed SEO extension, whether commercial or free, but WordPress is SEO-ready.

It can further extend the SEO feature via a few Nice FREE SEO plugins, including All in one SEO and Yoast. This well-known & popular plug-ins help you rank your website’s on multiple search engines like Google, Bing, and Yahoo.
Q: What is the basic difference between posts vs. Pages?
Posts and pages are the two content types used in WordPress. When WordPress is used as a blogging platform, the majority of the content posts. Posts are timed and are listed in chronological order with the latest posts on the top. The old posts are archived on the basis of month and year. Posts are meant to be shared and commented on.
Pages in WordPress, on the other hand, are static content that may include about us, contact us, privacy policies and others pages. The pages are timeless entries and do not have a date or month associated with them. For instance, even if you make changes to them, you will not have a Privacy policy page 2014 and Privacy policy page 2015 and so on. WordPress pages are not interactive and users do not share or comment on it.
Key differences:
  • Posts are timely entries and pages are not tied with time.
  • Pages cannot be included in RSS feed, while posts can.
  • Posts are shared on social media and pages are not.
  • Posts are categorized on the basis of time, whereas, pages are hierarchical.
  • There is no custom template in posts but they are in the pages.
Q: Write some of the basic features of WordPress?
Basic features of WordPress:
  • Posts are listed entries that are maintained in chronological order timely, but Pages are static and that are are not bounded with time.
  • Posts are for everyone means social, but in contrast Pages are NOT social. You can categorize Post accordingly, but Pages are maintained in hierarchical order.
  • Posts are displayed in RSS feed, but not Pages.
  • Pages are featured with custom template, but Posts are not.
The key features of WordPress are:
  1. Simplicity
  2. Flexibility
  3. Publish with Ease
  4. Publishing Tools
  5. User Management
  6. Media Management
  7. Easy Theme System
  8. Extend with Plugins
  9. Built-in Comments
  10. Search Engine Optimized
  11. Multilingual
  12. Easy Installation and Upgrades
  13. Importers
  14. Community
  15. Contribute
Q: Briefly explain the procedure to pass a variable by value in WordPress?
Ans: Passing a variable by value in WordPress is similar to as that in C++. We have to just add an ampersand in front of the variable to do the task. $X= &$Y
Q: What is the simplest way to find out the number of parameters passed into a function?
Ans: It is really easy to find out the no. of parameters passed into the function by following the below-provided command: func_num_args()
Q: Can you tell me when you will use endif function to end the condition statement?
Ans: The endif function is used to end the conditional statement when the parent if is followed by: and the code is blocked without the use of any braces.
Q: What is the difference between starting a string with a single quote and double quote? What you will use in general instance?
Ans: A data kept inside a single quoted string is not parsed for variable substitution whereas when we initialize the string with the double quote the data is parsed for variable substitution. If we don’t require variable substitution particularly then it is always preferred to use a single quote as it is a much speedy process.
Q: Can you briefly explain the ternary conditional operator in PHP language?
Ans: Ternary Condition is a very popular operator in PHP which evaluates the expression preceding the ?. If the condition is true then it executes the expression preceding: and If the condition is false then it executes the expression following. Syntax: exp? if exp is true then this code: else this code
Q: Briefly explain how include and require are different from each other?
Ans: Both include and require scans the program. If the require() function doesn’t find any file then the script will not execute. On the other hand, if the include() file can’t find a file or encounter any error then the warning notification will be raised but the script will still execute.
Q: Let a program is trying to assign the value 09875 to a variable but it keeps coming up with a different value; Do you know why it is happening?
Ans: The error in the output is due to the fact that the interpreter declares a number as octal if it starts with 0.
Q: Briefly explain the difference between accessing a class method via -> and via ::?
Ans: When we access a class method via -> we will require object initialization but when we choose:: we can access the methods which perform a static operation.
Q: How to get the current page name in WordPress?
Ans:You can get the page name from below of two? $slug = basename(get_permalink()); OR $pagename = get_query_var('pagename');
Q: How do I ge the version of wordpress?
Ans: echo bloginfo('version'); Above is get from below file. You can check in wp-includes/version.php $wp_version = '4.1.2';
Q: How to turn off the Notice/Warning from my wordpress website?
Ans:Open the wp-config.php file and WP_DEBUG set the false. define('WP_DEBUG', false );
Q: What is use of __() and _e() functions in wordpress?
Ans:These are function used when you website multilingual. each of this function have two parameter. 1st parameter: String which you want to convert from one language to another. 2nd parameter: domain name.
Q:What are the types of hooks in WordPress and mention their functions?
There are two types of hooks
1) Action Hooks
2) Filter hooks
Hooks allow user to create WordPress theme or plugin with shortcode without changing the original files. Action hooks allow you to insert an additional code from an outside resource, whereas, Filter hooks will only allow you to add a content or text at the end of the post.
Q:What is the prefix of WordPress tables by default?
Ans: By default, wp_ is the prefix for WordPress, it can be changed as per your need from wp-config.php
Q:Which is the best multi-lingual plugin for WordPress?
Ans:Keeping all the limitations in mind, WPML would be the best multi-lingual plugin for WordPress.
Q:Who is founder of WordPress?
Ans: Matthew Charles Mullenweg.
Q:What types of hooks in WordPress is used?
Ans: 1) Following are Actions hooks:
  • has_action()
  • add_action()
  • do_action()
  • do_action_ref_array()
  • did_action()
  • remove_action()
  • remove_all_actions()
2) Following are Filters hooks:
  • has_filter()
  • add_filter()
  • apply_filters()
  • apply_filters_ref_array()
  • current_filter()
  • remove_filter()
  • remove_all_filters()
Q:How to write the short code in WordPress php file?
Ans:Using do_shortcode() function inside of php tag.

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

The shortcode is used in WordPress post or page and text box widget and php file.