WordPress Interview Questions and Answers 2


Q1. 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:

   define(‘DISALLOW_FILE_EDIT’, true);

Q2. 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.


Q3. 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.


Q4. 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:

   <?php    $translated = __( ‘WordPress Interview Questions’, ‘mytextdomain’ );?>

Q5. How will you hide the top Admin Bar using a WordPress filter?

Ans. Add this code above to your functions.php file in the active theme.

   add_filter(‘show_admin_bar’, ‘__return_false’);

Q6. 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.


Q7. 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)

Q8. Share some tips to increase the page load speed of a WordPress website.

Ans.

  • 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.

Q9. 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.

You can check earlier set of WordPress Interview Questions & Answers here.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.