WordPress interview questions

Hooks, filters, AJAX, REST, security, queries, performance and the “it’s broken, why?” questions WordPress interviewers love.

Readiness: 0 of 58 nailed

How to use this page: 1. Read a question2. Type your answer3. Check with AI4. Open the model answer5. Timed drill when you’re 70% ready

Hooks

FoundationConcept

What is a hook in WordPress?

FoundationConcept

What is the difference between an action and a filter?

JuniorConcept

What are the third and fourth parameters of add_action / add_filter?

Mid-levelIt’s broken: why?

remove_action isn’t removing a plugin’s hook. What can cause it?

// in my theme's functions.php
remove_action('wp_head', 'someplugin_print_meta');
JuniorConcept

In what order do the main WordPress hooks fire on a front-end page load?

Mid-levelWrite it by hand

How do you register hooks inside a PHP class, and why can it be hard to unhook them later?

JuniorIt’s broken: why?

Your save_post callback sends an email twice, or runs for revisions and autosaves. How do you fix it?

add_action('transition_post_status', function ($new, $old, $post) {
  if ($new === 'publish' && $old !== 'publish' && $post->post_type === 'event') {
    myplugin_notify_subscribers($post->ID);
  }
}, 10, 3);
Mid-levelIt’s broken: why?

Calling wp_update_post() inside a save_post callback crashes the site. Why?

function myplugin_save($post_id) {
  remove_action('save_post', 'myplugin_save');
  wp_update_post(['ID' => $post_id, 'post_excerpt' => 'Auto excerpt']);
  add_action('save_post', 'myplugin_save');
}

AJAX

Mid-levelIt’s broken: why?

Your WordPress AJAX call isn’t working. What could be the cause?

add_action('wp_ajax_load_more', 'myplugin_load_more');

function myplugin_load_more() {
  echo json_encode(['html' => '...']);
}
JuniorWrite it by hand

Write a complete, secure AJAX request in WordPress (PHP + JS).

Themes and assets

FoundationConcept

How should you add CSS and JavaScript files in WordPress? Why not just put <script> tags in header.php?

FoundationConcept

What is a child theme and why use one?

JuniorConcept

Explain the template hierarchy. Which file does WordPress use for a single “product” post?

FoundationWrite it by hand

Create a shortcode [button url="/contact"]Contact us[/button].

JuniorConcept

What is the difference between a classic theme and a block theme? What is theme.json?

FoundationPredict the output

What is the difference between these two lines?

$html = '<h2>' . the_title() . '</h2>';
$html = '<h2>' . get_the_title() . '</h2>';

Queries and data

JuniorConcept

What is the difference between WP_Query, get_posts() and query_posts()?

Mid-levelWrite it by hand

Exclude a category from the home page and show 12 posts per page without creating a new query.

JuniorConcept

What are custom post types, taxonomies and post meta? When would you use each?

JuniorConcept

What is the Options API, and what is autoload?

Mid-levelReal-world scenario

When would you create a custom database table instead of using posts and meta?

FoundationConcept

What is The Loop, and what does the_post() actually do?

Security

JuniorConcept

What is the difference between sanitising, validating and escaping?

JuniorConcept

What is a nonce in WordPress, and what does it protect against?

JuniorIt’s broken: why?

What is wrong with this code and how do you fix it?

global $wpdb;
$email = $_GET['email'];
$user = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}subscribers WHERE email = '$email'");
SeniorReal-world scenario

A client’s WordPress site was hacked. What do you do now, and how do you prevent it next time?

JuniorConcept

Explain roles and capabilities. Why check capabilities instead of roles?

Mid-levelIt’s broken: why?

A plugin protects a delete action with if (is_admin()). Why is that a security bug?

Mid-levelConcept

What is xmlrpc.php, and why do people disable it?

Mid-levelWrite it by hand

How do you handle a front-end file upload securely in WordPress?

Debugging

JuniorIt’s broken: why?

A WordPress site shows a white screen or “There has been a critical error”. How do you fix it?

// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);     // writes to wp-content/debug.log
define('WP_DEBUG_DISPLAY', false); // don't show errors to visitors
Mid-levelIt’s broken: why?

Scheduled emails from your plugin are sent late, or not at all. Why?

// schedule once, e.g. on plugin activation
if (!wp_next_scheduled('myplugin_daily_report')) {
  wp_schedule_event(time(), 'daily', 'myplugin_daily_report');
}
add_action('myplugin_daily_report', 'myplugin_send_report');

// wp-config.php: disable traffic-based cron
define('DISABLE_WP_CRON', true);
// server crontab: */5 * * * * curl -s https://site.com/wp-cron.php > /dev/null
JuniorIt’s broken: why?

After installing SSL, the padlock is broken and some images load over HTTP. What’s wrong?

Mid-levelIt’s broken: why?

The site shows “too many redirects” after moving behind Cloudflare. Why?

FoundationIt’s broken: why?

“Allowed memory size exhausted” in WordPress. What do you do?

JuniorConcept

Which tools do you use to debug WordPress?

Performance

Mid-levelConcept

What are transients, and how is the object cache different?

Mid-levelReal-world scenario

A client says their WordPress site is slow. Walk me through what you do.

Mid-levelIt’s broken: why?

A listing page filtering posts by three custom fields with meta_query takes 6 seconds. Why, and what do you do?

FoundationConcept

How does WordPress handle image sizes, and how do you serve responsive images?

Mid-levelConcept

Which WP_Query arguments make queries faster?

REST API and blocks

Mid-levelWrite it by hand

Create a custom REST API endpoint that returns the latest 5 events, readable by anyone.

Mid-levelConcept

How do you build a custom Gutenberg block? What is the difference between a static and a dynamic block?

JuniorWrite it by hand

How do you call an external API from WordPress the right way?

Mid-levelConcept

How do you authenticate REST API requests in WordPress?

SeniorConcept

How does the block editor manage data, and how do you read post meta inside a custom block?

WooCommerce

Mid-levelWrite it by hand

Add a 5% fee to the WooCommerce cart when the payment method is Cash on Delivery.

Plugins

Mid-levelReal-world scenario

How do you structure a professional WordPress plugin?

Mid-levelWrite it by hand

How do you build a settings page for your plugin properly?

JuniorConcept

How do you make a plugin translatable?

JuniorConcept

What are must-use plugins?

Architecture

SeniorReal-world scenario

How would you scale a WordPress site to handle a million visitors a day?

SeniorConcept

What is WordPress Multisite and when would you avoid it?

Mid-levelReal-world scenario

What is headless WordPress? When would you recommend it and when not?

Tooling

JuniorConcept

What is WP-CLI and what do you use it for?

JuniorReal-world scenario

Walk me through migrating a WordPress site to a new domain.

Mid-levelReal-world scenario

What does a professional WordPress development workflow look like?

Also prepare