Top WordPress Interview Questions and Answers in 2018 for experienced are here. This consistently updated series of WordPress Interview Questions and Answers has 45 questions till now.
These interview questions are asked generally from a WordPress developer having around 3 or 5 or more years of experience. However, freshers can also take their expertise at an advanced level with help of these Interview Questions and Answers.
Updated 45 WordPress Interview Questions and Answers in 2018
WordPress has a wide range of questions asked in interviews. These questions are spread among a wide array of topics including core, plugins, themes, multisite as well as troubleshooting. Either you’re a fresher or experienced or just have an interest in WordPress, this QA series is useful for everyone.
We have updated this article in 2018. As we’re adding more questions about WordPress, We’ve divided the article into pages. So you will see recently added WordPress Interview Questions and Answers to the first page. Take your time and read the WP questions and answers as well as good luck for your interview.
Top 45 WordPress Interview Questions and Answers
Q45. What user roles are available in WordPress?
Ans. WordPress has these six roles has by default and each role has several capabilities.
- Super Admin (Multisite)
Q44. What types does WordPress offer to create a multisite network?
Ans. WordPress offers two types of multisite network, subdomains and subdirectories.
Q43. How to break a post in multiple pages?
Ans. Use <!–nextpage–> Quicktag in WordPress post editor wherever you wish to insert the page break. Also, write the tag in the text mode, not in the visual mode.
Additionally, there are more ways to break the post and you can read them here.
Q42. 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 the 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.
Q41. Can you name action as well as filter functions?
Q40. What are the template tags in WordPress?
Ans. A template tag is a code that instructs WordPress to “do” or “get” something. Like in the header.php, we use the tag bloginfo ( ‘name’ ) to get “Site Title” from the wp-options table which is set in Setting > General in WordPress admin.
The the_title() template tag is used to display the post title.
wp_list_cats() is to display categories.
get_header() for getting header.
get_sidebar() to display the sidebar on page.
get_footer() to get the footer content on page.
Q39. how to write the shortcode in WordPress?
Ans. Using do_shortcode() function in PHP echo language construct as shown:
<?php echo do_shortcode("[shortcode]"); ?>
Shortcodes are used in WordPress posts as well as pages. WordPress widgets, templates and PHP files also use shortcodes.
- Remove unused shortcodes
- Use shortcodes in WordPress Widgets
- Disable the plugin shortcode button in the post editor
Advance Interview Questions and Answers – WordPress
Q38. What are general rules/steps to follow in WordPress plugin development?
- Find a unique name.
- Setup a prefix (related to your brand).
- Create the plugin’s folder.
- Add sub-folders for PHP files, assets, and translations.
- Create the main plugin file and fill in the 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.
- Set up activation and deactivation functions as well as an uninstall script.
Q37. What steps you would take if a WordPress site is hacked?
- Install a security plugin.
- 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.
- Scan the system using Anti-virus program integrated into your hosting panel.
Q36. In which cases you don’t see the plugin menu?
Ans. You can’t see the plugin menu when the blog is hosted on free wordpress.com. Since you can’t add plugins there. Also, if you do not have an account of an administrator level on your WordPress dashboard, it is not possible to see plugins menu.
Q35. What is the difference between the wp_title and the_title tags?
Ans. wp_title() function is for using outside “The Loop” and to display the title of a Page. On the other hand, the_title() is used within “The Loop” for the same.
Q34. How to modify the parent theme behavior within the child theme?
Ans. The child theme could optionally override other template files like author.php, category.php, functions.php, style.css etc. The WordPress framework first looks for a template file in the child theme directory. If a file doesn’t exist there then it will pick the same from the parent directory. So create the similar template file in the child theme to modify the parent file.
Q33. How to Create Custom Post Types?
Ans. Custom Post Types are new post types that you can create. A Custom Post Type can be added to WordPress using the register_post_type() function. Further, this function allows you to define a new post type by its labels, supported features, availability and other specifics.
Here’s a basic example to add a “Product” post type:
Also read a detailed series of 6 articles: https://fellowtuts.com/wordpress/6-steps-custom-post-types-wordpress/.
Q32. 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.
Q31. What do next_posts_link() and previous_posts_link() do?
Ans. The post queries are usually sorted in reverse chronological order. So next_posts_link() usually points to older entries (toward the end of the set). Similarly, previous_posts_link() usually points to newer entries (toward the beginning of the set).
Top WordPress Interview Questions and Answers in the Year 2017
Q30. How to create MailChimp or vertical response campaign for newsletter subscribers and link with WordPress?
Ans. First of all, create a list and campaign in the MailChimp account. Then subscribe users from WordPress in the MailChimp list using either the official plugin or the web form.
Q29. What options are there to implement a multi-language site?
Ans. WordPress has no bi/multi-language feature built in by default. However, you can extend the site with plugins as well as themes that have multi-language features built-in.
Q28. How will you retrieve adjacent posts (next/previous) within the same category?
Ans. We can retrieve the previous post using get_adjacent_post() function. Also, pass true as the first parameter and the taxonomy name in the last parameter. Setting the third parameter to false will pull next adjacent post instead of the previous one.
Q27. How to create Custom Taxonomy specific to a Custom Post Type?
Ans. Register the taxonomy to that CPT by passing the Custom Post Type name as the argument in the register_taxonomy() function.
For more details: Add custom taxonomy in CPT.
Q26. How can I stop WordPress from prompting me to enter FTP information when doing updates?
Ans. If you can edit your wp-config.php file then you can preload necessary FTP settings as constants. Further, WordPress will read these constants while connecting to the server. However, on a shared host, you should be mindful of possible security implications.
Q25. How to activate plugins via code?
Ans. Plugins are stored in an array in the active_plugins option in the database. Further, this array contains the file path to each plugin that is active. So you would need to determine the path to activate a plugin. Then pass that path to activate_plugin() function.
Additionally, you need to include the plugin.php file from wp-admin/includes/, before calling the activate_plugin() function. You should also check to make sure your plugin isn’t already active. The result looks something like this:
WordPress Interview Questions and Answers for Beginners and Experienced
Q24. What’s the difference between site_url() and home_url()?
Ans. The site_url() references the field labeled “WordPress Address (URL)” in General > Settings. Also, the site_url() will always be the location where you can reach the site by tacking on /wp-adminon the end.
Whereas the home_url() would be where you have set your homepage by setting General > Settings “Site Address (URL)” field. So appending /wp-admin/ to site_url() always gives the location of the WP admin area. This may or may not be the case for home_url().
Ans. Add your own scripts via wp_enqueue_script() function along with appropriately setting dependencies and other parameters. You might need wp_enqueue_scripts() action hook as well.
Q22. How to set a global variable in the functions.php?
Ans. It is a pure PHP question for sure. Just trying to confuse you with including functions.php here.
$my_site_var = $some_array['0'];
If you declare a variable with the “global” keyword while initializing it then it will be available thereafter.
Q21. List default Post Types given in WordPress.
Ans. WordPress has the following default Post Types:
- Post (Post Type: post)
- Page (Post Type: page)
- Attachment (Post Type: attachment)
- Revision (Post Type: revision)
- Navigation menu (Post Type: nav_menu_item)
Q20. Share some tips to increase the page load speed of a WordPress website.
- Use lazy loading of images and videos.
- Install a caching plugin such as Super Cache or W3 Total Cache.
- Set up a Content Delivery Network like MaxCDN or CloudFlare.
- Use Gzipped compression to the server as well as set expire header.
- Reduce HTTP request.
- Optimize the database and files as well.
- Minify resources if the feature isn’t available in the caching plugin.
Q19. Can we run multiple domains from a single WordPress install?
Ans. Yes. We can run multiple domains form a single WordPress installation using domain mapping.
Q18. How will you hide the top Admin Bar using a WordPress filter?
Add this code above to your functions.php file in the active theme.
Q17. How can you turn a string into a slug in WordPress?
Ans. You can convert a string to slug by hooking the sanitize_title filter. For example: sanitize_title(‘WordPress Interview Questions’) will produce “wordpress-interview-questions” slug.
Q16. How will you hide the top Admin Bar with CSS only in the frontend?
Ans. Add the following CSS rule in your theme’s stylesheet:
15 WordPress Interview Questions – Updated in 2015
Q15. What is _e() in WordPress?
Ans. This function is similar to the __() function as explained below, just there is a difference. Rather than retrieving the translated string, this function displays that to the page. In other words, you can treat it as PHP “echo” for the translated string.
Q14. What is __() in WordPress?
Ans. This WordPress function makes a string inside your plugin or theme translatable or retrieves the translated string from the translate() function. Like:
$translated = __( 'WordPress Interview Questions', 'mytextdomain' );
Q13. How will you prevent automatic update to a plugin which you have modified?
Ans. You can do it by changing the name of the plugin’s directory then activating it again into your WordPress dashboard. Alternatively, you can modify the name of the plugin to achieve the same.
Q12. How will you display error messages during development?
Ans. You can change the value of WP_DEBUG constant from false to true in the wp-config.php file. Additionally, WP_DEBUG_LOG and WP_DEBUG_DISPLAY are two more constants available in WordPress for debugging.
Q11. Plugin or Theme, Which loads first?
Ans. Plugins load before the theme, which gives plugins some special privileges over themes and can even result in one or more plugins preventing the theme from ever loading.
Q10. How pages are different from posts in WordPress?
Ans. Pages are different from posts as they don’t get archived in the same manner as posts. They are neither categorized nor tagged. Also, pages don’t appear in the listing of recent blog posts or date archives. Further, WordPress doesn’t syndicate them in the RSS feeds available on your site.
Q9. What if your web hosting provider doesn’t have mod_rewrite activated?
Ans. In that case, the custom permalinks will work only if you use index.php before any custom permalink tag.
For example, create the custom permalink tag like this:
This format creates a permalink like:
Q8. What are Avatars and Gravatars?
Ans. An avatar is an online graphical representation of an individual. It’s a small graphic icon that people use to visually represent themselves on the web where they participate in conversations. Discussion forums, as well as blog comments, are two such examples.
Gravatars stands Globally Recognized Avatars. They are quite popular since millions of people and websites use them. WordPress has built-in support for Gravatars. When a user leaves a comment along with email on a site that supports Gravatar, it pulls their Globally Recognized Avatar from Gravatar servers.
Q7. How will you disable theme and plugin editing in your WordPress admin?
Ans. Adding the following constant will disable theme and plugin editing from within the WordPress admin:
Basic Interview Questions Answers for WordPress
Q6. What tables are added to the WordPress database when the multisite feature is activated?
Ans. WordPress adds six additional tables in the database during multisite installation.
- wp_blogs: Stores information about each blog created in your network.
- wp_blog_versions: Stores general information about each network blog ID, database version, and date of the last update.
- wp_registration_log: Stores information about registered users.
- wp_signups: Stores information about user sign-ups, including all the information from the wp_registration_log table. Also stores the date the user account was activated as well as the unique activation key the user accessed during the sign-up process.
- wp_site: Stores information about the main installation site, including the site ID, domain, and server path.
- wp_sitemeta: Stores all the information about the multisite configurations set after you install the multisite feature.
Q5. What tables are there in the WordPress database and what they store?
Ans. There are 11 tables by default in WordPress database as specified below:
- wp_commentmeta – Stores every comment published to the site and contains information, or metadata.
- wp_comments – Stores the body of the comments published to the website.
- wp_links – Stores the name, URL, and description of all links you create by using the WordPress Link Manager.
- wp_options – Stores all the option settings that you set for WordPress after you install it. Also, it includes all theme and plugin option settings.
- wp_postmeta – Includes all posts and pages published to your site and contains metadata.
- wp_posts – This table features the body of any post or page you’ve published to the blog. It also contains autosaved revisions and post option settings.
- wp_terms – Stores the categories you’ve created for posts and links as well as tags that have been created for posts.
- wp_term_relationships – Stores relationships among posts as well as categories and tags that have been assigned to them.
- wp_term_taxonomy – WordPress has three types of taxonomies by default, named category, link, and tag. This table stores the taxonomy associated with terms stored in the wp_terms table.
- wp_usermeta – Stores metadata from every user having an account on the WordPress website.
- wp_users – The list of users having an account on the WordPress website is maintained within this table.
Q4. How are WordPress versions named?
Ans. WordPress core developers are fond of jazz music. Since the initial release, all major WordPress releases are named in honor of jazz musicians they admire.
Q3. What is a Content Management System (CMS)?
Ans. A Content Management System (CMS) is a platform that lets you run a full website on your domain. Besides being a blog, WordPress CMS allows you to create pages. Further, it lets you build additional features into the website that have nothing to do with the content on the blog.
Q2. Where is content stored on a WordPress website?
Ans. All the content is stored in a MySQL database in your hosting account for a WordPress website.
Q1. What is WordPress?
Ans. The WordPress software is a personal publishing system that uses PHP and MySQL platform. Further, WordPress provides you everything you need to create your blog or website. Also, it publishes your content dynamically without the need to program the pages yourself.