WordPress Developer Interview Questions and Answers

WordPress powers a huge share of the web, and agencies hire for it constantly. Interviews check whether you can extend it the WordPress way, with hooks, child themes and plugins instead of editing core, and whether you understand blocks, the REST API, security and performance.

53 questions with answersLevels: Fresher to SeniorUpdated November 2026

Core concepts

The basics every WordPress developer should explain well.

Q1.What is the difference between WordPress.org and WordPress.com?

WordPress.org provides the open-source software you install on your own hosting with full control over plugins and code. WordPress.com is a hosted service by Automattic where hosting is handled for you and plugin and theme access depends on the plan.

Q2.What are hooks in WordPress?

Points where your code can run or change data without editing core. Actions run code at a moment, such as init or save_post. Filters receive a value, change it and return it, such as the_content.

Q3.What is the difference between add_action and add_filter?

add_action attaches a function to an action hook and its return value is ignored. add_filter attaches a function that must return the filtered value. Both accept a priority, where lower numbers run first, and the number of accepted arguments.

Q4.What is The Loop?

The code that goes through the posts returned for the current request and displays each one, using have_posts() and the_post() to set up global post data for template tags like the_title().

Q5.What is the template hierarchy?

The rules WordPress uses to choose a template file for a request, from the most specific to the most general. For a single post of type book it tries single-book.php, then single.php, then singular.php, then index.php.

Q6.What is a child theme and why use one?

A theme that inherits from a parent theme and overrides only the files or styles you change. Parent theme updates do not wipe your changes. For block themes, a child theme can also override theme.json settings.

Q7.What are custom post types and custom taxonomies?

Custom post types add new content types, such as products or events, with register_post_type. Custom taxonomies add new ways to group content, such as genre, with register_taxonomy. Register them on the init hook.

Q8.What is post meta?

Extra data stored per post as key-value pairs in the wp_postmeta table, managed with get_post_meta, update_post_meta and delete_post_meta. Plugins like ACF provide interfaces for it.

Q9.Name the main WordPress database tables.

wp_posts for all post types, wp_postmeta, wp_users, wp_usermeta, wp_options, wp_terms, wp_term_taxonomy, wp_term_relationships, wp_termmeta, wp_comments and wp_commentmeta. The prefix can change.

Q10.What is the Options API?

Functions like get_option, update_option and add_option for storing site-wide settings in wp_options. Options set to autoload are loaded on every page, so large autoloaded options slow sites down.

Q11.What are shortcodes?

Tags like that run a PHP callback and output content inside posts. They still work, but blocks are now the recommended way to add dynamic content in the editor.

Q12.What is wp-config.php used for?

It holds database credentials, table prefix, security keys and salts, debug settings such as WP_DEBUG, and constants such as memory limits and disabling the file editor.

Q13.What are permalinks and why flush rewrite rules?

Permalinks are the URL structure for posts and pages. When you register a new post type or rewrite rule, the stored rules must be regenerated, which happens when you visit Settings > Permalinks or call flush_rewrite_rules once on plugin activation, never on every page load.

Q14.What are must-use plugins?

PHP files in wp-content/mu-plugins that load automatically before normal plugins and cannot be deactivated from the admin. Hosts and agencies use them for site-critical code.

Plugin and theme development

Questions for hands-on developers.

Q15.How do you create a basic plugin?

Create a folder in wp-content/plugins with a main PHP file that has a plugin header comment. Add your hooks, prefix all functions or use a namespace and class, and use activation and deactivation hooks for setup and cleanup.

Q16.How do you enqueue scripts and styles correctly?

Use wp_enqueue_script and wp_enqueue_style on the wp_enqueue_scripts hook (or admin_enqueue_scripts in the admin), with dependencies and version numbers. Never hard-code script tags in header.php.

Q17.How do you pass data from PHP to JavaScript?

wp_add_inline_script with a JSON-encoded object, or the older wp_localize_script. For dynamic data, fetch from the REST API with a nonce.

Q18.What is WP_Query and when do you use it?

A class for custom post queries with arguments for post type, taxonomy, meta, dates, ordering and pagination. Use it for secondary loops and call wp_reset_postdata() afterwards. To change the main query, use pre_get_posts instead.

Q19.Why should you avoid query_posts?

It replaces the main query after it has already run, wasting a query and breaking pagination and conditional tags. Use pre_get_posts or a new WP_Query.

Q20.What is pre_get_posts?

An action that lets you change the main query before it runs, for example showing 20 products per page on an archive. Check is_main_query() and !is_admin() so you do not affect other queries.

Q21.What are transients?

Cached values with an expiry stored with set_transient and get_transient. With a persistent object cache like Redis they live in memory; otherwise they are stored in the options table.

Q22.What is the object cache?

WordPress caches data during a request with wp_cache functions. With a persistent object cache drop-in such as Redis or Memcached, cached queries and objects survive between requests and reduce database load.

Q23.How do you add an admin settings page?

Register a menu with add_menu_page or add_options_page, register settings and fields with the Settings API, sanitise values with a callback and check capabilities before saving.

Q24.What are capabilities and roles?

Roles like editor and subscriber are groups of capabilities like edit_posts or manage_options. Always check current_user_can with a capability, not with a role name.

Q25.How do you build a custom WooCommerce feature without editing the plugin?

Use WooCommerce's actions and filters, override templates in your theme's woocommerce folder only when needed, and use its CRUD classes and APIs rather than writing to the database directly. Test with HPOS order storage enabled.

Q26.How do you handle AJAX in WordPress?

The modern way is a custom REST API route with a permission callback, called with fetch and a nonce. The older way uses admin-ajax.php with wp_ajax_ and wp_ajax_nopriv_ hooks and check_ajax_referer.

Blocks and modern WordPress

Gutenberg, block themes and the REST API.

Q27.What is Gutenberg?

The block editor introduced in WordPress 5.0, where content is built from blocks. It is part of a larger project that also brought full site editing, block themes and patterns.

Q28.How do you create a custom block?

Scaffold it with @wordpress/create-block, define it in block.json with attributes and supports, write the edit component in React with WordPress components, and either save static markup or render it on the server with a render.php file for dynamic blocks.

Q29.What is block.json?

The metadata file for a block: name, title, category, attributes, supports, scripts, styles and render file. register_block_type reads it, and it enables performance improvements like loading assets only when the block is used.

Q30.What is the difference between static and dynamic blocks?

Static blocks save their HTML into post content. Dynamic blocks render with PHP on each request, so they suit content that changes, like latest posts, and changing their markup does not cause block validation errors.

Q31.What is a block theme and theme.json?

A block theme is built with HTML templates and template parts made of blocks, edited in the Site Editor. theme.json controls global settings and styles such as colour palettes, typography, spacing and which controls users see.

Q32.What are block patterns?

Predefined groups of blocks users can insert and edit, registered in PHP or as files in a theme's patterns folder. Synced patterns update everywhere they are used.

Q33.What is the Interactivity API?

A standard way to add front-end interactivity to blocks using directives in markup and a small store in JavaScript, with server rendering. It replaces scattered custom jQuery or vanilla scripts.

Q34.How do you register a custom REST API endpoint?

Use register_rest_route on the rest_api_init hook with a namespace, route, methods, callback, argument validation and a permission_callback. Never leave permission_callback empty for private data.

Q35.What is headless WordPress?

Using WordPress only as a content backend and building the frontend with a framework like Next.js, fetching content through the REST API or WPGraphQL. It gives frontend freedom but you lose some plugin features that rely on themes.

Q36.What is WP-CLI?

A command-line tool to manage WordPress: install, update plugins and core, search and replace in the database, manage users, run cron events and write custom commands for automation.

Q37.What is the Block Bindings API?

It connects block attributes, such as a paragraph's content or an image URL, to dynamic sources like post meta, so core blocks can show custom field values without writing a custom block.

Security and performance

Keeping WordPress sites safe and fast.

Q38.What is the difference between sanitising, validating and escaping?

Validating checks input is what you expect, such as a valid email. Sanitising cleans input before saving, with functions like sanitize_text_field. Escaping cleans output for its context right before printing, with esc_html, esc_attr, esc_url and wp_kses_post.

Q39.What are nonces in WordPress?

Tokens that confirm a request came from your site and was intended by the user, used against CSRF. Create with wp_nonce_field or wp_create_nonce and check with check_admin_referer, check_ajax_referer or wp_verify_nonce. They are not a replacement for capability checks.

Q40.How do you prevent SQL injection in WordPress?

Use $wpdb->prepare for any custom query with variables, or use WP_Query and the API functions, which handle escaping. Never put request data directly into SQL.

Q41.How do you harden a WordPress site?

Keep core, plugins and themes updated, remove unused plugins, use strong passwords and two-factor authentication, limit login attempts, disable file editing in the admin, set correct file permissions, use HTTPS and keep off-site backups.

Q42.How do you speed up a slow WordPress site?

Measure with Query Monitor and PageSpeed Insights. Add page caching and a persistent object cache, use a CDN, optimise images, reduce heavy plugins and page builder bloat, clean autoloaded options, and use a recent PHP version.

Q43.What is WP-Cron and what are its limits?

A scheduler that runs tasks when someone visits the site. On low-traffic sites tasks run late, and on high-traffic sites it adds overhead. Disable it with DISABLE_WP_CRON and run wp-cron.php from a real server cron job.

Q44.How do you debug WordPress?

Enable WP_DEBUG and WP_DEBUG_LOG in wp-config.php on a staging site, read wp-content/debug.log, use Query Monitor to see queries, hooks and errors, and use Xdebug for step debugging.

Q45.How do you make a theme or plugin translatable?

Wrap strings in functions like __(), _e(), esc_html__() and _n() with a text domain, load the text domain, and generate a POT file with WP-CLI's i18n command.

Q46.How do you safely move a site from staging to production?

Back up both, move files and database, run a serialisation-safe search and replace of URLs with WP-CLI, check wp-config settings, flush permalinks and caches, and test forms and payments.

Scenario questions

Practical problems from client work.

Q47.A site shows a white screen after a plugin update. What do you do?

Check the error log or enable WP_DEBUG_LOG. If a plugin is the cause, rename its folder over SFTP to deactivate it, restore the site, then test the update on staging and report the bug to the developer.

Q48.The admin dashboard is very slow but the front end is fine. Where do you look?

Plugins doing heavy work on admin_init or making external HTTP calls, large autoloaded options, a huge wp_postmeta table without good queries, the Heartbeat API and missing object caching. Query Monitor shows the slow parts.

Q49.A client wants a custom field on products shown in a filterable list. How do you build it?

Add the field with ACF or register_post_meta, show it in the product template, and build the filter with a WP_Query using meta_query or a taxonomy, which is faster to filter on than meta for large catalogues.

Q50.How would you migrate a page builder site to blocks?

Audit templates and reusable sections, rebuild them as block patterns and templates in a block theme, move content page by page, set redirects for any URL changes and compare performance and SEO before and after.

Q51.You inherit a site that was hacked. What are your steps?

Take it offline or into maintenance, back it up for analysis, change all passwords and keys, replace core, plugins and themes with clean copies, scan uploads for PHP files, check users and the database for injected content, then patch the entry point and request a review in Search Console if flagged.

Q52.How would you build a membership area?

Use roles and capabilities for access, a membership plugin or custom code to restrict content with checks in templates and the REST API, integrate payments through a trusted gateway, and cache pages carefully so private content is never cached publicly.

Q53.How would you structure a large multi-author news site on WordPress?

Custom post types and taxonomies for sections, editorial roles and workflows, a persistent object cache and full-page caching with a CDN, image CDN, scheduled posts with real cron and a lean block theme with patterns for consistent layouts.

How to prepare for the interview

  • Have a custom plugin or block on GitHub that you wrote yourself, not just sites built with page builders.
  • Know the escaping and sanitising functions by name; interviewers often ask you to fix insecure code.
  • Be ready to write a WP_Query with meta and taxonomy conditions.
  • Understand block themes and theme.json, since most new themes use them.