1. WordPress Basics and Core Concepts (25 Questions)
Q1. What is WordPress and how does it function as a CMS?
WordPress is an open-source Content Management System (CMS) based on PHP and MySQL. It functions by retrieving data from a database and rendering it through a template system (themes). It allows users to manage website content without needing to write code manually for every page.
Q2. What are the minimum requirements to run WordPress?
To run WordPress effectively, your server should support:
- PHP: Version 7.4 or greater.
- Database: MySQL version 5.7+ or MariaDB version 10.3+.
- Server: Apache or Nginx (recommended).
- HTTPS: Support for SSL.
Q3. Explain the purpose of the wp-config.php file.
This is the most important configuration file in WordPress. It contains the database connection details (DB Name, User, Password, Host), security keys, and developer options like WP_DEBUG.
//PHP
define( ‘DB_NAME’,
‘database_name_here’ );
define( ‘DB_USER’, ‘username_here’ );
define( ‘DB_PASSWORD’, ‘password_here’ );
define( ‘DB_HOST’, ‘localhost’ );
Q4. What is the difference between WordPress.org and WordPress.com?
WordPress.org is the self-hosted version where you have full control over the code and plugins. WordPress.com is a hosted service managed by Automattic, which is easier to start but has more restrictions on customization unless you pay for higher tiers.
Q5. What is the “Loop” in WordPress?
The Loop is the default mechanism WordPress uses to output posts. It cycles through the database results for the current request and displays the title, content, and metadata for each post found.
Q6. Write a basic example of the WordPress Loop.
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
the_title(‘<h2>’, ‘</h2>’);
the_content();
endwhile;
else :
echo ‘No posts found’;
endif;
?>
Q7. What are the default post types in WordPress?
WordPress comes with five main default post types:
- Post (post)
- Page (page)
- Attachment (attachment)
- Revision (revision)
- Navigation Menu (nav_menu_item)
Q8. What is the difference between a Post and a Page?
Posts are timely, chronological entries often used for blogs and appear in RSS feeds. Pages are static “one-off” content types, like an “About Us” or “Contact” page, and are not categorized by date.
Q9. How do you enable Debug mode in WordPress?
You must edit the wp-config.php file and change the WP_DEBUG constant to true. This will display PHP errors and notices on your site.
define( ‘WP_DEBUG’, true );
Q10. What is a “Slug” in WordPress?
A slug is the user-friendly, URL-valid name of a post, page, or category. For example, if your post title is “How to Learn PHP,” the slug might be how-to-learn-php.
Q11. Explain the directory structure of a standard WordPress installation.
- wp-admin: Contains administrative files.
- wp-includes: Contains core logic and API files.
- wp-content: Contains user-uploaded content, themes, and plugins.
Q12. What is the purpose of the .htaccess file in WordPress?
The .htaccess file is used by the Apache web server to handle permalinks and redirects. It tells the server how to route requests to the index.php file so WordPress can process them.
Q13. How do you change the site URL and Home URL via code?
You can define them in wp-config.php to override the database settings:
//PHP
define( ‘WP_HOME’, ‘https://example.com’ );
define( ‘WP_SITEURL’, ‘https://example.com’ );
Q14. What are Categories and Tags?
Categories are used for broad grouping of posts (hierarchical), while Tags are used for specific descriptors or keywords (non-hierarchical).
Q15. What is a Permalink?
A permalink is the permanent URL of a specific post or page. WordPress allows you to customize these (e.g., /post-name/ vs /?p=123) in the Settings menu.
Q16. How does WordPress handle user roles and capabilities?
WordPress uses a Role-Based Access Control (RBAC) system. Default roles include Administrator, Editor, Author, Contributor, and Subscriber, each having specific “capabilities” (like editing posts or managing plugins).
Q17. What is the role of index.php in a WordPress theme?
index.php is the ultimate fallback file. If WordPress cannot find a specific template (like category.php or single.php), it will default to using index.php to display content.
Q18. What is a Taxonomy?
A taxonomy is a way to group things together. Categories and Tags are built-in taxonomies, but developers can create custom ones (like “Genres” for a Book post type).
Q19. How do you create a new user in WordPress programmatically?
You can use the wp_create_user() or wp_insert_user() functions.
//PHP
$user_id = wp_create_user( ‘username’, ‘password’, ’email@example.com’ );
Q20. What is the difference between wp_head() and wp_footer()?
These are template tags that allow WordPress and plugins to “hook” into the header and footer of your site. They are essential for loading CSS, JS, and tracking scripts.
Q21. What is an “Auto Draft”?
When you click “Add New Post,” WordPress creates an “Auto Draft” in the database immediately. This ensures that if your browser crashes before saving, a version of the post exists.
Q22. How do you delete a post programmatically?
You use the wp_delete_post() function. Passing true as the second parameter bypasses the trash and deletes it permanently.
wp_delete_post( $post_id, true );
Q23. What are “Child Themes”?
A child theme inherits the functionality and styling of another theme (the parent). It is the safest way to modify a theme without losing changes when the parent theme is updated.
Q24. How do you fetch the ID of the current post inside the loop?
You can use the function get_the_ID().
PHP
$current_id = get_the_ID();
Q25. What is the global $wpdb object?
$wpdb is a global variable that provides an interface to the WordPress database. It is used to perform custom SQL queries safely.




