FAQs

434

questions

Hooks

Can wp_insert_comment fire without a real visitor ever submitting anything?

Yes — any code that calls wp_insert_comment() directly, including import tools, migration scripts, and other plugins, triggers this hook exactly as if a visitor had submitted the comment.

Do these five hooks fire in the order they’re registered in code?

No — they fire in a fixed pipeline order determined by the REST API’s own request lifecycle (rest_pre_dispatch → authentication → routing → rest_prepare_* → rest_insert_*), regardless of when your plugin registers its callbacks.

Does comment_approved always reflect a comment’s final status?

No — it reflects the moderation outcome at the moment comment_post fires. A comment can be manually approved or marked as spam afterward by a moderator, and that later change doesn’t re-fire comment_post.

Does rest_insert_post fire for posts saved through the normal editor, not the REST API?

No — it fires specifically for posts created or updated through a REST API request. A normal editor save fires wp_insert_post and save_post, not rest_insert_post.

Is sanitizing in comment_text enough to prevent stored XSS from comments?

No. comment_text only affects what’s displayed at render time — the raw value is already stored in the database by the time this filter runs. Real protection has to happen at submission, before the comment is inserted.

View all in Hooks

Hook actions

Can I cancel a deletion from inside delete_attachment?

No — this action fires as notification, not permission. It can't stop the delete from proceeding.

Can I read the image dimensions inside add_attachment?

Not yet — metadata generation happens afterward. Hook wp_generate_attachment_metadata if you need sizes or EXIF data.

Can I redirect the user somewhere custom after logout?

Yes — hook wp_logout (or the logout_redirect filter for more control over the target URL) and call wp_safe_redirect() followed by exit.

Can I redirect users away from wp-admin on admin_init?

Yes, that's a very common pattern — check current_user_can() and wp_redirect() + exit if the check fails, being careful to allow admin-ajax.php requests through.

Can I use after_setup_theme in a plugin?

Yes, but it's primarily meant for themes. Plugins usually use plugins_loaded or init instead.

View all in Hook actions

Hook filters

Can I hide the admin footer text entirely?

Return an empty string from the filter — WordPress will render the footer area with no text.

Can I remove a default body class instead of adding one?

Yes — search $classes with array_search() and unset() the key, then return the array.

Do I still need wp-login.php to exist after filtering login_url?

Only if something still links to it directly. This filter changes what wp_login_url() outputs; it doesn't disable the real wp-login.php endpoint.

Does an attachment post exist when this filter runs?

No — this fires before wp_insert_attachment() creates the post, so there's no attachment ID available yet.

Does changing wp_mail_from fix WordPress emails going to spam?

It helps, but deliverability mainly depends on SPF/DKIM/DMARC records and your mail sending method — this filter alone won't fix a misconfigured domain.

View all in Hook filters

Jobs

Are there freelance WordPress developer opportunities?

Yes. Many engagements start as freelance or part-time WordPress block developer work before a longer hire. Share your GitHub, plugin contributions, and Gutenberg experience when you reach out.

Are WordPress developer jobs remote?

Most 4WP.dev collaborations are remote-friendly. Specify timezone and availability when you contact us — whether you are applying for a role or hiring for your distributed team.

Can I hire a Gutenberg block developer for a specific project?

Yes — Gutenberg developer for hire covers custom blocks, inner blocks, block bindings, editor sidebar tools, and block libraries for agencies. For full agency subcontract scope, see also For Companies.

How do I hire a WordPress developer through 4WP.dev?

Use the Contacts popup on this page or visit Contacts. Share role scope, stack (Gutenberg, REST, WooCommerce, etc.), and timeline. Review the open-source portfolio first to see production code quality.

What are the candidate preparation checklists?

Coming soon: structured guides to prepare for WordPress technical interviews — Gutenberg APIs, PHP architecture, hooks, REST, testing, and how to demo a plugin from the 4WP ecosystem or your own repos.

View all in Jobs

Pactices cases Plugin development base 4WP-Plugins

4WP Booking FAQ

Does it require Elementor?

No. Elementor is optional. The Gutenberg block and [forwp_booking] shortcode work on any block theme without page builders.

Is 4WP Booking an official Clinic Cards plugin?

No. Clinic Cards is a third-party service by Cliniccards Corp. 4WP Booking is an independent product by 4wp.dev that communicates with Clinic Cards via their documented API.

What is Clinic Cards?

Clinic Cards is a cloud CRM for dental clinics — interactive schedule, patient cards, visual treatment plans, finances, inventory, online booking, and eHealth integration. 4WP Booking connects your WordPress site to their public API.

What patient data is sent to Clinic Cards?

When a visitor submits the booking form: name, phone, email, optional comment, selected service, date, and time. Data is sent only on submit, not during browsing.

Where is the Clinic Cards API key stored?

In WordPress options on your server. The key is never included in front-end HTML or JavaScript — all API requests are server-side HTTPS calls to cliniccards.com/api.

View all in 4WP Booking FAQ

4WP Health

Does Apple Health work in the browser?

Not yet. Apple Health has no web OAuth flow. A future release may add an iOS bridge or third-party aggregator through the provider registry.

Is my health data sent to 4wp.dev?

No. Samples are stored in your WordPress database on your server. The plugin does not phone home to 4wp.dev.

What Google APIs are used?

Google OAuth for authorization and the Google Fitness API for activity datasets — steps, distance, calories, and exercise sessions — only after the user consents and an admin saves valid OAuth credentials.

What is 4WP Health?

A WordPress plugin that lets logged-in users connect Google Health / Fitness data — with admin charts, Gutenberg metric blocks, REST endpoints, and a provider registry for future sources.

Where can I get the source code?

Clone or download from GitHub. Part of the 4WP Bundle ecosystem.

View all in 4WP Health

4WP Icons

Can I use custom SVG?

Yes. Choose the custom SVG option in the icon library when Lucide does not include your mark — useful for logos and client-specific assets.

Does it work with core blocks?

Yes. Toolbar controls add icons to Button, Heading, Paragraph, List, and Quote blocks in addition to the standalone 4WP Icon block.

Is there front-end JavaScript for icons?

No. Icons render as inline SVG on the server. Visitors do not load a Lucide React runtime — keeping pages lightweight.

What is 4WP Icons?

A Gutenberg block plugin that brings the Lucide icon set (1000+ icons) into WordPress with a searchable picker, custom SVG support, links, and inline icons for selected core blocks.

Where do I get the plugin?

Source and releases are on GitHub. It powers iconography across 4WP.dev and ships as part of the 4WP Bundle ecosystem.

View all in 4WP Icons

4WP Multilingual FSE

Do I need separate templates for each language?

No. Templates keep base slugs like header. You create locale-specific template parts (header-en, footer-de, etc.) or map custom slugs in the admin table.

Does it change the Site Editor or only the front end?

Swapping runs on the front end (and is suspended during admin/REST). Editors still manage all parts in the Site Editor; admin tabs help map, clone, and audit coverage.

Does it work with block patterns?

Version 0.2 adds pattern language scope and filters the block pattern inserter via REST so editors see patterns relevant to the active language.

What does 4WP Multilingual FSE do?

It resolves base FSE template part slugs (header, footer, and custom parts) to language-specific versions on the front end, based on the active Polylang or WPML locale.

What happens if a language-specific part is missing?

The resolver falls back to the base slug so the site keeps working. The Design System tab highlights missing variants so you can clone them in one click.

View all in 4WP Multilingual FSE

4WP Planner

Does it integrate with Google Calendar?

MVP includes ICS feed export and per-item “Add to Google Calendar” links. Two-way Google OAuth sync is on the roadmap — see GOOGLE-SETUP.md in the repository for current setup notes.

Does it publish content or run automations?

No. Planning only — no automated actions. 4WP Planner helps you organize work and due dates; it does not post to WordPress, social networks, or deploy plugins on your behalf.

Is it on WordPress.org?

Not yet. Install from the GitHub repository. An official directory listing has not been submitted.

Is it ready for production?

No — early-stage development. The plugin is actively evolving (currently v0.3.0). APIs, admin screens, and calendar sync may change between releases. Use on staging or internal installs until we publish a stable roadmap.

Is there a REST API?

Yes — namespace fwpp/v1 with routes for projects, plans, items, calendars, insights, and meta. Useful for future dashboards or internal tooling; treat endpoints as unstable during early development.

View all in 4WP Planner

4WP Responsive

Can I use custom spacing values?

Yes. Presets use named utility classes; arbitrary values use a has-forwp-*-custom class with a CSS variable (for example --forwp-padding-top-mobile: 150px) instead of inline styles.

Do I need a custom block?

No. The plugin extends blocks that already support spacing, typography, and alignment — such as Heading, Paragraph, Group, and List — via sidebar controls.

Does it add JavaScript on the front end?

No. Output is limited to utility CSS classes and CSS variables. A single generated stylesheet handles responsive rules — no front-end script dependency.

How does it use theme.json?

Spacing and font-size presets are read from the active theme’s theme.json. Breakpoints can be defined in settings.custom.breakpoints; when present, they override plugin defaults and lock conflicting admin fields.

Is 4WP Responsive on WordPress.org?

Not yet. The plugin has not been submitted to the official WordPress.org directory. Install and review the source from the GitHub repository.

View all in 4WP Responsive

4WP-Bundle

Do I need 4WP Bundle to use other 4WP plugins?

No. Each 4WP plugin works standalone. Bundle is recommended when you run several 4WP plugins and want one dashboard, catalog sync with GitHub, and shared addon blocks in the editor.

How do I enable or disable an addon block?

Go to 4WP Bundle → Addons, check or uncheck each addon, and click Save. Disabled addons are not registered on init, so they disappear from the block inserter.

How do I install from GitHub?

Download the zip from github.com/4wpdev/4wp-bundle, upload via Plugins → Add New, or use the Bundle dashboard to install sibling plugins from the catalog. Activate under Plugins.

How does the plugin dashboard work?

Under 4WP Bundle → Blocks, the UI lists every installed 4wp-* plugin and compares versions against the remote plugins.json manifest from GitHub. You can install missing plugins via download URL, activate or deactivate, update when a newer release exists, and open README or documentation links.

Is 4WP Bundle free and open source?

Yes — GPL v2 or later. Source on GitHub, maintained by 4WP.dev. Not on WordPress.org yet; install from GitHub or via the ecosystem dashboard.

View all in 4WP-Bundle

SOLID Principles in WordPress

Q: Can I use OCP without object-oriented programming in WordPress?

A: Absolutely! WordPress hooks (add_action, add_filter) are a perfect OCP implementation using procedural code. Your functions stay closed (working code), others extend via hooks (adding functionality). OOP adds more tools, but hooks alone achieve OCP beautifully.

Q: Doesn’t OCP make code more complex with all these abstractions?

A: Initially yes, but it pays off as the project grows. Start simple – a few hooks are enough for small plugins. Add interfaces and abstract classes when you have 3+ similar implementations. The complexity is justified when it prevents breaking existing functionality while adding features.

Q: How does OCP relate to WordPress plugin updates?

A: OCP is crucial for plugin compatibility. If your plugin follows OCP (provides hooks), users can extend it safely. When you update, their extensions keep working because they’re not modifying your code. This is why editing vendor plugin files is dangerous – updates erase custom changes.

Q: How many hooks should I add to my WordPress plugin?

A: Add hooks at logical extension points – before/after major operations, when data changes, or when rendering output. Follow WordPress core’s approach: do_action('before_save_'), apply_filters('the_content'), etc. Don’t overdo it – too many hooks make code hard to follow.

Q: Should every function have a filter in WordPress development?

A: No, only functions that return data users might want to modify. Use filters for content transformation (apply_filters('post_title', $title)), use actions for event notifications (do_action('post_saved', $id)). Internal helper functions don’t need hooks.

View all in SOLID Principles in WordPress

WordPress WP-CLI FAQ: Interview & Code Review Questions

WP-CLI Core Commands

Can I install WordPress in a subdirectory with WP-CLI?

Yes. Pass the full URL including the path to wp core install –url=. Download and config steps stay the same; only the site URL changes.

Can I run wp core install without wp config create?

No. WordPress needs database credentials in wp-config.php before installation. Without config, WP-CLI cannot connect to MySQL and the install will fail.

Do I always need wp db create?

Only when the database named in wp-config.php does not exist yet. On shared hosting the database is often pre-created — then skip this step. On local dev, create it with WP-CLI.

Should I pin a WordPress version when downloading?

For most installs, use the latest stable release without –version. Pin a version only when you intentionally need parity with production or a legacy environment.

What directory should I run wp core download in?

Use an empty directory for a fresh site. WP-CLI downloads core files into the current working directory. Mixing with existing files can leave stale plugins or themes from an old project.

View all in WP-CLI Core Commands

WP-CLI Database

Does wp db import drop the existing database before importing?

Yes. WP-CLI runs the .sql file against the current database, which typically begins with DROP TABLE IF EXISTS statements for each table. The result is a clean replacement of the existing data, not a merge. This is why the export step before import is critical — anything not in the backup file will not exist after the import.

How do I know the backup I am importing is from the right environment?

Run grep 'siteurl' backup.sql | head -5 before importing. The siteurl value in the dump shows which site and domain the backup came from. If it shows a localhost or staging URL, you will need to run wp search-replace after the import to fix all domain references.

What credentials does wp db import use?

WP-CLI reads the database host, name, user, and password directly from wp-config.php. You do not need to pass credentials on the command line. This is why wp db import backup.sql works without any additional flags.

What if the import fails halfway through?

The database may be in a partially restored state. First, check the error message — it usually points to a specific table or SQL statement. If the import file is valid, try running it again (WP-CLI’s import is generally idempotent for standard WordPress dumps because each table is dropped before recreating). If the file itself is corrupted, you need an earlier backup.

What is the difference between wp db export and a manual mysqldump?

wp db export is a thin wrapper around mysqldump that reads credentials from wp-config.php automatically. The resulting .sql file is compatible with wp db import and standard MySQL import tools. The main advantage over raw mysqldump is that you do not need to manually pass host, user, password, and database name on the command line.

View all in WP-CLI Database

General Questions

About 4WP.dev

Do I need prior WordPress experience?

Basic WordPress knowledge is helpful, but not mandatory.
4WP.dev is designed to support progressive growth, helping developers move step by step toward deeper expertise.

How can I get involved?

You can start by exploring the content, joining discussions, and following the learning paths.
4WP.dev grows through active participation and shared experience.

Is 4WP.dev a course or a community?

It’s both.
4WP.dev combines structured learning paths with a developer community focused on sharing experience, best practices, and real production knowledge.

Is 4WP.dev suitable for professional developers?

Yes.
The platform is built for developers who want to level up professionally, understand WordPress internals, and work with production-grade solutions.

What is 4WP.dev?

4WP.dev is a WordPress-focused platform for developers.
We bring together developers who want to build modern, scalable WordPress solutions through real-world practice, not theory.

View all in About 4WP.dev

For-Companies

Can I hire a Gutenberg block developer for a client project?

Yes. 4WP.dev offers subcontract and direct hire for block libraries, editor UX, plugin MVPs, and production hardening. Review the plugin portfolio first, then request a conversation.

Can you rescue or refactor an existing WordPress plugin?

Yes — common requests include Gutenberg migration, security hardening, test coverage, REST API cleanup, and SOLID restructuring without breaking live sites.

Do you build FSE themes and block libraries?

Yes. Full Site Editing themes, reusable block patterns, theme.json design systems, and editor-only block addons for agency design systems are core strengths.

Does 4WP.dev work with agency white-label workflows?

Yes. Engagements can run under your agency brand with direct technical communication, clear handoff docs, and Git-based delivery your team can maintain.

How do I evaluate expertise before subcontracting?

Audit open-source repos on GitHub, read architecture docs, inspect release cadence on WordPress.org, and review plugin singles on 4wp.dev — all public proof of how code is structured and shipped.

View all in For-Companies

For-Customers

Are 4WP plugins free?

Most are open source (GPL v2+) and free to install. Some are on WordPress.org; others install from GitHub, including via 4WP Bundle. There are no hidden license traps.

Can I use several 4WP plugins on one site?

Yes. They are built as a suite. 4WP Bundle helps install, activate, and update when you run more than one.

Do I need a developer to use these tools?

No. Install from the plugin page or WordPress.org, activate in wp-admin, then follow the short setup on each product page. Settings and blocks live in the WordPress admin and editor.

How do I know a plugin is maintained?

Check the latest release on WordPress.org or GitHub, read the product page, and skim the matching article when one exists. Public repos and release notes are the audit trail.

What if I need a small custom change?

Start with the product documentation, then contact 4WP.dev for guided setup or a small configuration adjustment.

View all in For-Customers

For-Developers

Are there REST API and MCP integration examples?

Yes. 4WP Bundle exposes 4wp/v1 REST endpoints; MCP Abilities connects AI agents to WordPress via the Abilities API — both with public source on GitHub.

Can I fork 4WP code for client projects?

Yes, under GPL v2+. Fork, adapt, and ship — respect the license and attribution. Many patterns (block wrappers, REST controllers, inventory tables) are reusable starting points for commercial work.

Does 4WP.dev cover modern Block Editor APIs?

Yes — block.json, InnerBlocks, block variations, Interactivity API, block bindings, Query Loop extensions, and editor sidebar plugins appear across the suite (FAQ, Advanced Code, QL Blocks, SEO Helper, MCP Abilities).

How does 4WP.dev teach Gutenberg block development?

Study plugin singles under /plugin/, clone repos, and follow guides on hooks, blocks, inner blocks, Interactivity API, and block bindings. Each plugin is a case study — not a toy demo.

How is 4WP.dev different from generic WordPress tutorials?

Content is anchored in shipped plugins — real settings screens, edge cases, release history, and SEO/GSC workflows. You learn from code that runs in production, not isolated snippets.

View all in For-Developers

WP-CLI Maintenance

Do I need –allow-root?

Only when you run WP-CLI as root (common on some VPS setups). Prefer a dedicated deploy user that owns the site files. This simulator accepts the commands without –allow-root.

In which order should I update core and plugins?

Core first, then wp core update-db, then plugins. Plugins often require a minimum WordPress version; updating them against outdated core can cause fatals.

Should I also back up files, not only the database?

Yes on real servers. Use a dated directory outside the web root for tar archives of the site plus wp db export. This interactive challenge focuses on WP-CLI commands; file archives remain part of the full protocol.

What does DISALLOW_FILE_MODS actually block?

It disables plugin and theme install/update (and related file editing) from the WordPress admin UI. Updates then happen via WP-CLI or controlled deploy pipelines — which is what you want on production business sites.

Why does elementor-pro fail with Unauthorized?

Many premium plugins authenticate downloads against the vendor API using a license tied to the site. WP-CLI bulk update may not complete that handshake. Installing a verified zip with wp plugin install … --force --activate is the reliable production pattern.

View all in WP-CLI Maintenance

Headless WordPress

Can headless WordPress still use SEO plugins like Yoast?

Partially. Yoast can still manage SEO titles, descriptions, and structured data as fields in the WordPress admin, but it no longer outputs anything into a page directly — the frontend has to read those fields via the API and render its own <title>, meta tags, and JSON-LD.

Can I just use WordPress’s default cookie authentication from a headless frontend?

Only if the frontend shares the exact same origin as WordPress, which is rare in a real headless setup. Across origins, cookie-and-nonce auth runs into CORS and SameSite restrictions that will block legitimate requests unpredictably — a token-based scheme avoids the problem entirely.

Can the REST API handle authenticated write requests from a separate-origin frontend?

Yes, but not with WordPress’s default cookie+nonce auth, which assumes same-origin. A cross-origin frontend needs a token-based scheme (Application Passwords or a JWT/OAuth layer) — covered in full on the Auth page.

Do you still need a WordPress theme in headless mode?

A minimal one, yes — WordPress still needs a theme to activate, and some admin-only screens still render through it. But the theme’s templates are irrelevant to what visitors see; all the real rendering logic lives in the frontend application.

Does going headless break SEO plugins like Yoast?

It doesn’t break the plugin’s admin fields, but it does mean those fields no longer automatically appear in the rendered page — the frontend has to explicitly fetch and render the title, meta description, canonical URL, and structured data itself.

View all in Headless WordPress

REST API

Can I add a custom post type’s data to wp/v2 without a custom endpoint?

Yes — registering the post type with show_in_rest => true gives it a full wp/v2-style route automatically, with the same field-extension tools (register_rest_field, meta REST visibility) available on top of it.

Do I need a permission_callback if the route is meant to be public?

Yes, and it should be explicit — __return_true is a valid permission callback that documents the route is intentionally open, rather than an oversight the next developer has to investigate.

Does showinrest expose a custom field publicly by default?

It depends on how the field was registered — meta fields need an explicit auth_callback if their visibility should be restricted; without one, the default behavior may expose more than intended, so it’s worth checking rather than assuming.

How many routes should share one controller class?

Routes that operate on the same underlying resource — one controller per resource (projects, services, bookings), not one controller for the entire plugin’s API surface.

How should pagination be enforced on a list endpoint?

With a sensible default per_page and an enforced maximum that a request can’t override, so no single call can pull an unbounded result set regardless of what the client requests.

View all in REST API

WooCommerce Development for Middle Devs: PHP and Gutenberg

WooCommerce as a System

How do you check in code whether HPOS is enabled?

AutomatticWooCommerceUtilitiesOrderUtil::custom_orders_table_usage_is_enabled().

How do you react to any order save?

The woocommerce_after_order_object_save hook — it fires no matter where the order was saved from: admin, REST, checkout, CLI.

What is a data store in WooCommerce?

A class responsible for saving and reading a specific object type. The CRUD object doesn't know where its data lives. That's why HPOS could be introduced without changing the public API: only the order data store changed.

What is sync mode?

During the transition WooCommerce writes orders to both storages. You can roll back, and old plugins that read wp_posts still get data. After the transition sync is turned off because it doubles every write.

What is wc_product_meta_lookup and why does it exist?

A denormalized table with a product's price, stock, SKU and rating. WooCommerce uses it for sorting and filters to avoid slow JOINs on wp_postmeta.

View all in WooCommerce as a System

Hooks and Extensions

Do PHP overrides work in a block theme?

Not for the parts rendered by blocks: a block has its own render. Some blocks (for example, the classic Legacy Template) still use PHP templates, but the main path is blocks.

How do you find the priority WooCommerce used to add a function?

Look in includes/wc-template-hooks.php, in Query Monitor → Hooks, or dump $wp_filter['hook_name'].

What does Requires Plugins do?

A plugin header since WordPress 6.5. Core won't activate the plugin until its dependencies are active, and won't deactivate a dependency while a dependent plugin is active.

What is a dynamic hook? Give an example.

A hook whose name contains a variable part. For example, woocommerce_order_status_completed or woocommerce_product_get_price — WooCommerce builds them from a status or property name.

What is the difference between an action and a filter?

An action does something at a given moment and returns nothing. A filter receives a value, changes it and must return it. Technically both run on the same WP_Hook system.

View all in Hooks and Extensions

Product Catalog

How do you find a product by SKU?

wc_get_product_id_by_sku( $sku ) — a lookup table query. Not a meta_query on _sku.

How do you get a variable product's price range?

$product->get_variation_price( 'min' ) and ( 'max' ), or get_price_html(). Don't loop over all variations by hand.

How do you hide a meta field from the REST API?

A _ prefix doesn't protect it from REST: meta_data returns all meta. Filter it with woocommerce_rest_prepare_product_object, or don't keep sensitive data in product meta.

How does a global attribute differ from a local one?

A global attribute is a pa_* taxonomy shared by all products: you can filter the catalog by it. A local one lives only in one product and has no filters.

How does wc_get_products() differ from WC_Product_Query?

Not in principle: wc_get_products() is a wrapper that creates a WC_Product_Query and returns the result.

View all in Product Catalog

Cart and Checkout

Can you build a headless store on the Store API?

Yes, that's its main use case together with blocks. But payment on an external frontend depends on the payment gateway: not every gateway supports paying through the Store API.

Does the Store API need authentication?

No, it's the customer's public API. Changes need the Nonce header (CSRF protection) and a session or a Cart-Token.

How do you add a fee to an order?

woocommerce_cart_calculate_fees and $cart->add_fee( $name, $amount, $taxable ). Fees are calculated on the server, so they work in both checkouts.

How do you add a field to block checkout?

With the Additional Checkout Fields API: woocommerce_register_additional_checkout_field() on the woocommerce_init hook, with an id in the namespace/name format, a location and a field type.

How do you add your own data to a Store API response?

With woocommerce_store_api_register_endpoint_data() for the endpoint you need (cart, cart item). The data shows up in the extensions.<namespace> field.

View all in Cart and Checkout

Gutenberg for the Store

How do you pass data from PHP to the store?

wp_interactivity_state( 'namespace', [...] ) — global state; wp_interactivity_data_wp_context() — the local context of a specific block.

What is block context?

A way to pass data from a parent block to its children: providesContext on the parent, usesContext on the child. Product Template passes the postId of every product.

What is Product Collection?

A WooCommerce block for product lists with ready-made collections (new arrivals, on sale, best sellers, related products) and filters. The inner Product Template defines the product card from separate blocks.

What is the Interactivity API?

The WordPress standard for frontend interactivity: the server renders HTML with data-wp-* directives, and a small runtime binds them to a JS store. Blocks on the same page can share state.

When should a block be dynamic?

When the data changes independently of content editing: prices, stock, user data, post lists. Then render.php generates the HTML on every request.

View all in Gutenberg for the Store

Orders, Payments, Shipping

How do you add refunds to a gateway?

Add refunds to $this->supports and implement process_refund( $order_id, $amount, $reason ) calling the provider's API.

How do you add your own WooCommerce email?

A class extends WC_Email with trigger() and templates, registered through woocommerce_email_classes. Then the email has its settings in WooCommerce → Settings → Emails.

How does processing differ from completed?

processing — payment received, the order has to be packed and shipped. completed — fulfilled. For virtual and downloadable products WooCommerce sets completed right after payment.

What does payment_complete() do?

It sets the status (processing or completed), saves the transaction ID and the payment date, reduces stock if it wasn't reduced yet and fires the woocommerce_payment_complete hook.

What does process_payment() return?

An array with result (success or failure) and redirect — the URL to send the customer to: the provider's page or the thank-you page.

View all in Orders, Payments, Shipping

APIs and Integrations

How do you add a field to the order response?

The woocommerce_rest_prepare_shop_order_object filter or register_rest_field() for the matching type.

How do you authenticate with the WC REST API?

Consumer key / secret through Basic auth over HTTPS. For requests from your own site (admin, blocks) — a cookie + the wp_rest nonce.

How do you avoid a sync loop?

Mark changes coming from the external system (a meta or a runtime flag) and don't send them back. Or define a single source of truth for every field.

How do you check a WooCommerce webhook signature?

Calculate base64_encode( hash_hmac( 'sha256', $raw_body, $secret, true ) ) and compare it with X-WC-Webhook-Signature using hash_equals().

How do you get all orders if there are 10,000 of them?

Page through with per_page=100 following X-WP-TotalPages, or filter by date (modified_after) and sync incrementally.

View all in APIs and Integrations

Performance and Security

Does a nonce protect against unauthorized access?

No. A nonce protects against CSRF — a forged request on behalf of the user. Whether the user has the right to the action is checked by current_user_can() or an owner check of the resource.

What are cart fragments and why are they criticized?

A mechanism that updates the mini cart with the get_refreshed_fragments AJAX request. It made an uncached server request on every page. In modern versions the script loads only where the classic cart widget is.

What does an object cache give you?

It keeps query results and transients in memory (Redis, Memcached) between requests. Fewer SQL queries on every page, especially for logged-in users and the cart.

What is IDOR in a store?

Insecure Direct Object Reference: a customer changes the order_id in a request and gets someone else's order. The protection is a check that the order belongs to the current user, or access by the order key.

When do you sanitize and when do you escape?

Sanitize on input, before saving. Escape on output, in the output context (HTML, attribute, URL). One doesn't replace the other.

View all in Performance and Security

Quality and Production

How do you review a junior's code?

The big picture first, then the details. Separate the must-haves from the nice-to-haves. Explain the reason and give links. Praise good decisions. Big changes — talk them through, not 40 comments.

How do you test logic that lives in hooks?

Move the logic into separate classes with pure methods, and only call them from the hook. Then unit tests cover the logic and integration tests cover the hook registration.

How does PHPCS differ from PHPStan?

PHPCS checks style and patterns (WPCS: escaping, nonce, prepare). PHPStan is static analysis of types and logic: non-existent methods, wrong types, dead code.

What do you automate in a PR?

Style (PHPCS), static analysis (PHPStan), tests, the JS build. The human keeps architecture, business logic and security in context.

What is special about Pantheon for a WordPress developer?

Clear Dev → Test → Live environments, code only through git, a read-only file system on Live and Test (except uploads), built-in Redis and edge-level caching.

View all in Quality and Production

Interview

How do you answer a WooCommerce system design question?

Clarify the requirements and the numbers, then data, flows, risks, verification. Name the choice "ready plugin / own code / external service" explicitly and say why.

What do you ask before designing?

Volumes (products, orders, peaks), the source of truth for the data, integrations, payment and tax requirements, who will maintain the solution, budget and deadlines.

What do you do if you don't know the answer?

Say so honestly and show your reasoning: what related things you know, where you would look, how you would check. The interviewer evaluates thinking, not memory.

What do you do in live coding if you get stuck?

Say what exactly doesn't work and what your hypotheses are. Asking for a hint is better than 5 minutes of silence. The interviewer evaluates the process.

What do you say about the block cart in the progress bar task?

That the woocommerce_before_cart hook works only in the classic cart. For the block cart — extend the Store API with your data and show it through a block or a cart slot.

View all in Interview

Git Basics Course

Git Basics

How does a distributed VCS differ from a centralized one?

In a centralized VCS (SVN), history is stored on a single server: without a connection to it, you can't commit or view history. In a distributed VCS (Git), every clone is a full copy of the repository with its entire history. That's why most operations are local and fast, and losing the server doesn't mean losing the history.

How is Git different from GitHub?

Git is a version control system that runs locally on your computer. GitHub is a cloud service that hosts Git repositories and adds team tools: pull requests, code review, issues, GitHub Actions. Git works without GitHub; alternatives to GitHub include GitLab and Bitbucket.

What does Git store: snapshots or diffs?

Snapshots. Every commit is a snapshot of the state of all project files; unchanged files aren't copied but point to the already stored version. Git computes diffs on the fly when you ask for them. Delta compression in pack files is just an on-disk storage detail, not the data model.

What states can a file have in Git?

Untracked — Git doesn't track the file yet. A tracked file can be unmodified (matches the last commit), modified (changed but not added) or staged (added to the staging area). After git commit, staged changes go into the repository and the file is unmodified again.

What's the difference between git init and git clone?

git init creates a new empty repository in the current folder. git clone <url> copies an existing repository with its entire history and branches and sets up the origin remote right away.

View all in Git Basics

Daily Workflow

How do you find who changed a line and when?

git blame file.php shows, for every line, the commit, author and date of its last change; -L 10,20 limits the range. Then git show <hash> opens the whole commit with context. To find the commit that added or removed specific text — git log -S "text".

How do you unstage a file without losing changes?

git restore --staged file.php (in older versions — git reset HEAD file.php). The file goes back to modified, and the changes in the working directory stay.

What do you do if a secret has already been committed?

First, treat the secret as compromised and rotate it (password, token, key): it stays in the history and in every clone. Then stop tracking the file and add it to .gitignore. History can be cleaned (git filter-repo, BFG), but that rewrites it for the whole team — rotating the secret matters more.

What does git add -p do?

It shows changes in pieces (hunks) and asks for each one whether to stage it: y — yes, n — no, s — split into smaller ones. That way you can make several logical commits from one file and avoid committing stray debug code.

What makes a good commit message?

A short subject line of up to ~50 characters in the imperative mood that says what the commit does: Fix price rounding in cart, not fix or changes. If needed, a blank line and a body: why the change was made and what its consequences are. One commit — one logical change, and the message comes out precise.

View all in Daily Workflow

Branching

How do you name branches?

By type and task: feature/cart-update, fix/price-rounding, hotfix/1.2.1, often with a ticket number — feature/123-cart-update. The prefix is visible right in the branch list and can be used in CI and branch protection rules.

How do you resolve conflicts?

git status shows the conflicted files. In each one I work through the <<<<<<<, =======, >>>>>>> markers: what each branch changed and why, and keep the right version — often a combination of both. I remove the markers, run the tests, then git add and git commit. For complex cases — the merge tool in the IDE.

How do you undo a merge that went wrong?

While the merge isn't finished — git merge --abort restores the starting state. If the merge commit is already created but not pushed — git reset --hard ORIG_HEAD. If it's already pushed — git revert -m 1 <merge-hash>.

How is git switch different from git checkout?

git checkout does too much: it both switches branches and restores files, so it's easy to make a mistake. Git 2.23 split it into git switch (branches only) and git restore (files only). Same result, unambiguous commands.

What is a detached HEAD?

A state where HEAD points to a specific commit rather than a branch — for example after git checkout <hash> or checking out a tag. New commits in this state don't belong to any branch and are easy to "lose" after switching. To keep the work — git switch -c <name>.

View all in Branching

Working with Remotes

How do you version releases?

With SemVer: vMAJOR.MINOR.PATCH. MAJOR — breaking changes, MINOR — new functionality without breaking, PATCH — fixes. I mark a release with an annotated tag on a commit in main, and the tag triggers the deploy in CI.

How is origin/main different from main?

main is your local branch that you commit to. origin/main is a remote-tracking branch: a local copy of the server's main as of the last fetch. You don't change it directly; it's updated by fetch and pull.

What does the -u flag do?

git push -u origin <branch> (--set-upstream) remembers the link between the local and the remote branch. After that, git push, git pull and git status (ahead / behind) work without arguments. To check the links — git branch -vv.

What is origin?

The default name git clone gives to the repository you cloned from. It's just a name for a URL: you can rename it or add other remotes, for example upstream for the original repository of a fork.

What's the difference between a lightweight and an annotated tag?

A lightweight tag is just a name pointing to a commit. An annotated tag (git tag -a) is a separate object with an author, date and message, and it can be signed. Releases use annotated tags: git describe and most tools rely on them.

View all in Working with Remotes

Team Workflows

Describe GitHub Flow.

main is always deployable. For each task — a short branch from main, regular commits and pushes, a Pull Request with review and green CI, merge into main and deploy. The branch is deleted after the merge.

How is Git Flow different from GitHub Flow?

GitHub Flow has one permanent branch, main, and short feature branches — built for continuous deploy. Git Flow has two permanent branches (main for releases, develop for integration) plus release/* and hotfix/* — built for planned, versioned releases. It's more complex but gives control over what goes into a release.

What do you check during code review?

That the change does what it claims and doesn't break anything nearby; readability and standards (WPCS); security — sanitizing, escaping, nonces, capability checks; query performance; tests. I write comments concretely, with a suggestion, and mark nitpicks as optional.

When should you use squash merge?

When the branch's intermediate commits ("fix typo", "wip") have no value for history: squash turns the PR into one meaningful commit in main. Not when the PR contains several separate logical changes that are useful to see and revert individually.

Which model would you pick for an online store with frequent releases, and why?

GitHub Flow: frequent releases need a short path from task to production, and develop plus release branches only add merges and delays. Risks are covered by CI, review, feature flags and quick rollback.

View all in Team Workflows

Rewriting History

How do you recover a commit after git reset –hard?

git reflog shows every move of HEAD with hashes, even for commits no longer in the branch. I find the right entry and go back: git reset --hard <hash>, or create a branch git branch rescue <hash>. The reflog is local and kept for about 90 days by default.

How do you roll back a bad release in main?

git revert the problematic commit (for a merge commit — git revert -m 1 <hash>), push, and ship a new release. In parallel — a quick deploy rollback to the previous tag. No reset and force push on main.

What is cherry-pick for?

To move one specific commit into another branch without merging the whole branch — for example a hotfix from main into a release branch. It creates a new commit with the same changes and a different hash. For many commits, merge or rebase is better.

What's the difference between merge and rebase?

Merge joins branches with a merge commit and keeps history as it was. Rebase moves your commits on top of another branch, creating new commits with new hashes — history becomes linear. The resulting code is the same; the difference is the history.

What's the difference between reset and revert?

git reset moves the branch back and removes commits from history — it rewrites it, for local changes. git revert creates a new commit that undoes an old one; history isn't rewritten, so it's safe for shared branches.

View all in Rewriting History

CI/CD on GitHub

How do you protect main from direct pushes?

A branch protection rule (or ruleset) for main: Require a pull request before merging, a required approval, Require status checks to pass, no force pushes. If needed, the rule applies to admins too.

How do you roll back a bad release?

Quickly — by redeploying the previous tag: re-running the workflow for the old release or switching to the previous release on the server. Then the fix: git revert in main and a new patch release.

How do you store deploy keys?

In GitHub Secrets — at the repository or Environment level (production with its own secrets and rules). In the workflow — via ${{ secrets.NAME }}; values are masked in logs. Never in code or in a committed .env; for deploys — a separate SSH key with minimal permissions.

How is your deploy set up?

A merge into main deploys to staging automatically. An annotated v* tag starts a workflow with environment: production that waits for manual approval, builds the artifact and ships it to the server. After the deploy — a smoke test.

What does a GitHub Actions workflow consist of?

A YAML file in .github/workflows/ with triggers (on) and one or more jobs. Each job runs on its own runner (runs-on) and consists of steps: commands (run) or ready-made actions (uses). Jobs run in parallel by default; dependencies are set with needs.

View all in CI/CD on GitHub

PHP for WordPress Developers

PHP Runtime in WordPress

How do you debug a white screen on a production WordPress site?

Turn on WP_DEBUG and WP_DEBUG_LOG with WP_DEBUG_DISPLAY off, reproduce the request and read the log. Since WordPress 5.2 a fatal error in a plugin or theme also triggers recovery mode and an email to the admin with the error and the file.

What changed in PHP 8.2 that broke many WordPress plugins?

Dynamic properties became deprecated: assigning a property that the class does not declare now raises a deprecation notice. Old plugins that attach data to objects on the fly flood the log until the properties are declared.

What does OPcache do and when do you need to reset it?

OPcache stores compiled opcodes of PHP files in shared memory, so files are not parsed on every request. When timestamp validation is off or delayed, a changed file keeps running the old code until the cache is reset, so a deploy should reload PHP-FPM or reset OPcache.

What does Requires PHP do?

It is a plugin header (and readme.txt field) with the minimum PHP version. Since WordPress 5.2 the plugin cannot be activated, and its updates are not offered, on a site with a lower PHP version, so new syntax never reaches a host that cannot parse it.

What is PHP-FPM and why do WordPress hosts use it?

PHP-FPM (FastCGI Process Manager) runs a pool of PHP worker processes separately from the web server. nginx or Apache passes .php requests to it over FastCGI. The pool can be sized and restarted independently, and each site can have its own pool, user and php.ini.

View all in PHP Runtime in WordPress

Uncategorized

Can I just call `wp_die()` instead of `WP_Error` if login should be denied?

Technically yes, but it’s a cruder solution: wp_die() halts execution immediately, without the standard error message in the login form, and makes testing harder. WP_Error is the expected contract that WordPress core knows how to display to the user properly.

Can I rely on WP-Cron for a task that has to run at an exact minute?

No. WP-Cron only guarantees that an event won’t run before its scheduled time — the actual moment it runs depends on when the next visitor arrives. For truly time-critical tasks, you need an external trigger: a system cron or a cloud scheduler.

Can I render Gutenberg blocks as React components?

Yes, with WPGraphQL Content Blocks: it returns blocks as typed data instead of one HTML string, and you map each block type to a component.

RelatedHeadless & Decoupled WordPress: Architecture, Trade-Offs, and Production PatternsGraphQL for Headless WordPress: Schema Design With WPGraphQLFrontend Architecture for Headless WordPress: Next.js, SPA, and Rendering StrategyBuilding a REST API Backend for Headless WordPressAuthentication for Headless WordPress: Beyond Cookies and NoncesDraft & Preview in a Headless WordPress Setup

Can I use this native authentication model for a headless frontend?

No — nonces and cookies require the same origin and an active browser session. A separate-origin frontend needs a token-based authentication scheme instead; see the Headless Auth page for that pattern.

Can I use wp core update –minor on production?

Yes, and it is recommended for automated pipelines. The –minor flag restricts updates to the current major branch (e.g. 6.x → 6.x patch), skipping major version jumps.