Freshers WordPress Interview Questions
What is WordPress?
WordPress is a free and open source Content Management System (CMS). It lets you create and manage a website without writing all the code yourself. You add content from a dashboard, choose a design with a theme, and add features with plugins.
It is written in PHP and uses a MySQL or MariaDB database. WordPress started in 2003 as a blogging tool, and today it runs around 4 out of 10 websites on the internet: blogs, business sites, news portals, online shops (with WooCommerce) and even web applications.
You can see the version of your own site with one command:
$ wp core version
7.1.4
Read more in WordPress Introduction.
In what year did WordPress come out?
WordPress came out in 2003. The first version (0.7) was released on 27 May 2003. It was started by Matt Mullenweg and Mike Little as a fork of an older blogging tool called b2/cafelog.
It began as a simple blog system. Over the years it got pages, plugins, themes, custom post types, the REST API and the block editor, and became a full CMS. Today it is maintained by a big community of volunteers.
Version 7.0 was released in May 2026. See What is new in WordPress 7.0?
How many default tables are in a WordPress database?
A fresh WordPress install creates 12 tables in the database:
$ wp db tables
wp_commentmeta
wp_comments
wp_links
wp_options
wp_postmeta
wp_posts
wp_term_relationships
wp_term_taxonomy
wp_termmeta
wp_terms
wp_usermeta
wp_users
The main ones are wp_posts (posts, pages and other content), wp_postmeta (custom fields), wp_options (settings), wp_users and wp_usermeta, wp_comments and the term tables wp_terms, wp_term_taxonomy and wp_term_relationships. Plugins can add more tables. Read WordPress Database.
Where is the WordPress content stored?
WordPress saves its content in two places:
- The database (MySQL or MariaDB): posts and pages (
wp_posts), custom fields, comments, users, categories and tags, and all settings (wp_options). - The file system: uploaded images and files in
wp-content/uploads, and the code of themes and plugins inwp-content/themesandwp-content/plugins.
So a full backup needs both the database and the wp-content folder. See Backup and Update.
What is the default table prefix for the WordPress database?
The default prefix is wp_, so the tables are named wp_posts, wp_options and so on. It is set in wp-config.php:
$ wp config get table_prefix
wp_
$ wp db prefix
wp_
You can choose another prefix when you install the site (like site1_), which also lets many sites share one database. In code, never write the prefix by hand, use $wpdb->prefix or $wpdb->posts.
What are the popular plugins in WordPress for SEO?
The most used SEO plugins in the WordPress.org directory are:
| Plugin | Active installs (rounded) |
|---|---|
| Yoast SEO | 10+ million |
| Rank Math SEO | 4+ million |
| All in One SEO | 2+ million |
They help with SEO title, meta description, sitemaps, canonical URLs, schema and content hints. Use only one of them. See WordPress SEO with Yoast and the full plugin list.
What is a WordPress theme?
A WordPress theme is a group of files (templates, stylesheets, images and sometimes JavaScript) that decide how your website looks. When you switch the theme, your posts and pages stay the same, but the design and layout change.
There are two kinds: classic themes with PHP templates (like single.php) and block themes with HTML templates and a theme.json file, which you edit in the Site Editor.
Themes are saved in wp-content/themes:
$ wp theme list –fields=name,status
name status
twentytwentyfive active
twentytwentyfour inactive
twentytwentythree inactive
Learn more in WordPress Themes.
What are commonly used WordPress theme functions?
| Function | Use |
|---|---|
| get_header(), get_footer(), get_sidebar() | Load header.php, footer.php, sidebar.php |
| wp_head(), wp_footer() | Hooks for scripts, styles and plugins. Needed in every theme |
| bloginfo( ‘name’ ) | Prints site details |
| home_url(), site_url() | Site addresses |
| the_title(), the_content(), the_excerpt() | Post details in the loop |
| the_permalink(), the_post_thumbnail() | Post link and featured image |
| wp_nav_menu() | Print a menu |
| dynamic_sidebar() | Print a widget area |
| get_template_part() | Load a reusable file |
| get_template_directory_uri() | URL of the theme folder |
Tags that start with the_ print, while get_the_ versions return the value. See Theme Files and Functions.
Describe WordPress files and directory structure
The root folder of a WordPress site contains:
| Item | Purpose |
|---|---|
| wp-admin | Dashboard code. Never edit |
| wp-includes | Core libraries. Never edit |
| wp-content | Your themes, plugins and uploads |
| wp-config.php | Database and main settings |
| index.php, wp-load.php, wp-settings.php | Start WordPress |
| wp-login.php | Login page |
| .htaccess | Rewrite rules (Apache) |
$ ls wp-content
index.php
mu-plugins
plugins
themes
uploads
More in WordPress Files and Folder Structure.
Which function is used to get the home URL in WordPress?
Use home_url(). It gives the address of the front of your site, and you can add a path to it:
$ wp eval 'echo home_url() . "\n" . home_url( "/contact/" ) . "\n" . site_url() . "\n" . get_bloginfo( "url" );'
http://example.com
http://example.com/contact/
http://example.com
http://example.com
home_url(): the address where visitors open the site.site_url(): the address where the WordPress core files are installed. It is different fromhome_url()only when WordPress is in a sub folder.get_bloginfo( 'url' ): same ashome_url().
Always use esc_url( home_url( '/' ) ) when you print it in HTML.
Which are the necessary files for a WordPress theme?
A classic theme must have two files:
style.csswith a header comment (at leastTheme Name).index.php, the fallback template.
Usually a theme also has header.php, footer.php, functions.php, single.php, page.php and screenshot.png. A block theme needs style.css and templates/index.html.
/*
Theme Name: Mini Theme
*/
<?php echo 'Hello from a two file theme';
$ wp theme activate tc-mini
Success: Switched to 'Mini Theme' theme.
$ curl -s http://example.com/
Hello from a two file theme
What is the difference between Posts & Pages in WordPress?
Posts are for blog or news content. They are shown newest first, can have categories and tags, appear in the RSS feed and usually allow comments.
Pages are for static content that does not change with time, like About us, Contact or Privacy Policy. They have no categories or tags, are not in the feed, can have a parent page (hierarchy), and can use page templates.
| Point | Posts | Pages |
|---|---|---|
| Order | By date | By menu or page order |
| Categories and tags | Yes | No |
| Hierarchy | No | Yes |
| In RSS feed | Yes | No |
Both are saved in the same wp_posts table, with a different post_type (post or page). See Posts and Pages.
What are the different user roles in WordPress?
A role is a named group of permissions (called capabilities). WordPress has five default roles:
| Role | What the user can do |
|---|---|
| Administrator | Everything on the site |
| Editor | Publish and manage all posts and pages, and comments |
| Author | Write, publish and manage only his own posts |
| Contributor | Write his own posts, but cannot publish them |
| Subscriber | Only manage his profile |
$ wp role list –fields=role,name
role name
administrator Administrator
editor Editor
author Author
contributor Contributor
subscriber Subscriber
On a multisite network there is also the Super Admin role. Read more in Users and Roles.
What is Post Status in WordPress?
Post status is the state of a post or page. It is saved in the post_status column of the wp_posts table.
| Status | Meaning |
|---|---|
| publish | Live and visible to everyone |
| draft | Saved, not published |
| pending | Waiting for review |
| future | Scheduled for a future date |
| private | Visible only to logged in admins and editors |
| trash | In the trash (restore it or delete it forever) |
| auto-draft | Created automatically when you open the add new screen |
You can see the status of your posts with WP-CLI:
$ wp post list –post_type=post,page –fields=ID,post_title,post_status
ID post_title post_status
1 Hello world! publish
2 Sample Page publish
3 Privacy Policy draft
What is the recommended permission for WordPress files and folders?
| Item | Permission |
|---|---|
| Folders | 755 |
| Files | 644 |
| wp-config.php | 600 or 640 |
| 777 | Never use it |
The numbers decide who can read, write and run the file (owner, group and others). Also the user of the web server must own the files or be able to write in wp-content/uploads, otherwise uploads and updates fail.
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 600 wp-config.php
See WordPress Security.
What is the default WordPress sitemap URL?
Since WordPress 5.5 a sitemap is created automatically at /wp-sitemap.xml:
$ curl -s http://example.com/wp-sitemap.xml | grep -o "<loc>[^<]*</loc>"
<loc>http://example.com/wp-sitemap-posts-post-1.xml</loc>
<loc>http://example.com/wp-sitemap-posts-page-1.xml</loc>
<loc>http://example.com/wp-sitemap-taxonomies-category-1.xml</loc>
<loc>http://example.com/wp-sitemap-users-1.xml</loc>
It lists the sitemaps for posts, pages, categories and users. If you install an SEO plugin like Yoast SEO, the plugin makes its own sitemap (/sitemap_index.xml) and the core one is redirected to it. Send the sitemap address to Google Search Console.
What are the new features added in WordPress 5.5?
WordPress 5.5 (released in August 2020) brought these main changes:
- XML sitemaps built in at
/wp-sitemap.xml. - Lazy loading of images by default with the
loading="lazy"attribute. - Auto updates for plugins and themes, which you can turn on one by one.
- Block patterns and the block directory to find and install blocks from the editor.
- Better block editor: inline image editing, a new block design and the drag and drop upload.
- Install or update a plugin or theme by uploading a zip file.
You can still see two of them on a current site:
$ curl -s http://example.com/wp-sitemap.xml | grep -o "<loc>" | wc -l
4
$ wp eval 'echo wp_filter_content_tags( "<img src=\"a.jpg\" width=\"300\" height=\"200\" alt=\"\">" );'
<img loading="lazy" decoding="async" src="a.jpg" width="300" height="200" alt="">
More on versions: What is new in WordPress 7.0?
What is the use of the wp_head() function in WordPress?
wp_head() is a function that fires the wp_head action. It is called in header.php just before </head>. Plugins and WordPress use that hook to print things in the head: enqueued styles and scripts, meta tags, the canonical link, the RSS links and SEO data.
Without wp_head() many plugins and the styles you enqueue will not load. Its partner is wp_footer(), which must be before the closing </body> tag.
<?php
add_action( 'wp_head', function () {
echo '<meta name="author" content="Tutorials Class">' . "\n";
} );
$ curl -s http://example.com/ | grep 'name="author"'
<meta name="author" content="Tutorials Class">
What is the difference between WordPress.com and WordPress.org?
WordPress.org is where you download the free WordPress software. You install it on your own hosting and you control everything: themes, plugins, code and data. You must look after updates, backups and security by yourself.
WordPress.com is a company service (by Automattic) which hosts WordPress sites for you. It is easier to start, but the free plan is limited, and custom plugins and themes need a paid plan.
| Point | WordPress.org | WordPress.com |
|---|---|---|
| Type | Self-hosted software | Hosted service |
| Cost | Free software, you pay for hosting | Free plan and paid plans |
| Plugins and themes | Any | Limited by plan |
| Maintenance | You | WordPress.com |
More details: WordPress.com vs WordPress.org.
What is a plugin in WordPress? How is it different from a theme?
A plugin is a PHP file or folder which adds a feature to WordPress, like a contact form, SEO tools, backups or an online shop. It works with hooks, so the core files are not changed.
| Point | Theme | Plugin |
|---|---|---|
| Job | Design and layout | Features and functions |
| Changes when you switch it | The look of the site | The feature turns off |
| Folder | wp-content/themes | wp-content/plugins |
| Active at a time | Only one theme | Many plugins |
A good rule: if the code is about how the site looks, it belongs to the theme; if it is a feature which must work with any theme (like a custom post type), make a plugin.