Hook filters

35

questions

Answers to common questions about WordPress filter hooks, from body_class and render_block to wp_mail_from and login_url. Each entry clarifies what a filter actually changes, when it runs, and what it does not do.

Can I hide the admin footer text entirely?

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

Used in

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.

Used in

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.

Used in

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.

Used in

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.

Used in

Does filtering comment_text change the comment stored in the database?

No — it only changes what's rendered on display. The database row is untouched.

Used in

Does lowering this threshold affect already-uploaded images?

No — it only affects images processed after the filter is added; existing attachments aren't retroactively rescaled.

Used in

Does render_block run for classic-editor content?

No — only for actual blocks. Classic editor HTML that isn't parsed into blocks goes through the_content filters instead.

Used in

Does script_loader_tag work for scripts I just echo manually?

No — only for scripts registered via wp_enqueue_script()/wp_register_script(). Manually echoed <script> tags aren't touched.

Used in

Does the_excerpt run for manually written excerpts too?

Yes — it runs regardless of whether the excerpt was typed in the editor or auto-generated from content.

Used in

Does this filter affect images pasted as raw HTML in the editor?

No — only images rendered through WordPress's own attachment image functions (wp_get_attachment_image and friends), not raw <img> HTML.

Does this filter disable WP-Cron?

No — set the DISABLE_WP_CRON constant to true for that. This filter only adjusts the self-spawned HTTP request's arguments.

Used in

Does this run on every page load for existing images?

No — only when metadata is generated or explicitly regenerated (new upload, or a 'Regenerate Thumbnails' action), not on normal display.

How do I reject a login attempt from this filter?

Return a WP_Error object. Returning null lets WordPress continue checking other registered authenticate callbacks instead of stopping the login outright.

Used in

How do I target only one specific menu?

Check $args->theme_location (or $args->menu) inside the callback and return $items unchanged for every other menu.

Used in

I added a column but the cells are blank — what’s missing?

manage_posts_columns only adds the header. You also need add_action( 'manage_posts_custom_column', … ) to echo the actual value for each row/column combination.

Used in

Is it safe to allow SVG uploads with this filter alone?

No — pair it with an SVG sanitizer library or plugin. The raw filter only changes what's accepted, not what's safe.

Used in

Is the wp_title filter deprecated?

The wp_title() template tag is legacy — modern themes render titles via wp_get_document_title() and the document_title_parts filter. wp_title only fires if a theme still calls wp_title() directly in header.php.

Used in

Is this the right hook to build a headless auth layer?

Yes — it's the standard extension point for custom REST authentication schemes like API keys or signed requests.

Used in

post_class vs body_class — which one do I use?

body_class targets the <body> tag once per page; post_class targets each individual post wrapper and runs once per post in the loop.

Used in

rest_prepare_post vs register_rest_field — which should I use?

register_rest_field is the documented way to add a field with schema support; rest_prepare_post is a lower-level filter for quick tweaks or removing/reshaping existing fields.

Used in

template_include vs single_template — which should I use?

single_template (and its siblings like page_template) only affect one specific query type; template_include is the catch-all that runs regardless of query type.

Used in

What does returning null mean versus WP_Error?

null means 'no opinion, defer to other checks'; a WP_Error means 'block this request with this specific error'.

Used in

What happens if I forget to return the metadata array?

The attachment loses its generated sizes and dimension data — always return $metadata, even unmodified.

What’s the default threshold?

2560 pixels on the long edge, introduced in WordPress 5.3.

Used in

What’s the difference between ‘upload’ and ‘sideload’ context?

'upload' is a direct user file upload; 'sideload' is a file pulled in programmatically, such as an image imported from a URL.

Used in

What’s the difference between rest_pre_dispatch and a route’s permission_callback?

permission_callback runs per-route after matching, for auth checks on that specific endpoint. rest_pre_dispatch runs before routing even happens and can intercept every request site-wide.

Used in

Why did my content disappear?

A the_content callback must return the string. Echoing instead of returning wipes the post body.

Used in

Why did my excerpt_length change do nothing?

The post already has a manually written excerpt, or the theme calls a hardcoded wp_trim_words() instead of get_the_excerpt() — this filter only affects the auto-generation path.

Used in

Why did the_title also change my menu item labels?

The filter runs anywhere get_the_title()/the_title() is called, including some menu-label code paths. Check the post type or scope the condition more tightly.

Used in

Why does my custom WP-Cron interval never fire?

Usually cron_schedules wasn't hooked before wp_schedule_event() ran, or the interval key name doesn't match exactly — WordPress silently ignores unknown interval names instead of throwing an error.

Used in

Why does the_content contain HTML comments like ?

Those are block delimiters the block editor saves into post_content. Each one already passed through the render_block filter before reaching the_content, so by the time your filter runs it's rendered HTML with block comments still attached — not raw block JSON.

Used in

Why doesn’t excerpt_more change my manual excerpt?

It only applies to auto-generated excerpts. A manually written excerpt is used exactly as typed, with no trailing string appended.

Used in

Why doesn’t my wp_title filter work on this theme?

Modern themes render the title via wp_get_document_title(), which uses document_title_parts — wp_title() usually isn't called at all.

Used in

Why would I need to touch this on a high-traffic site?

High-traffic sites often disable the default request-triggered cron and drive wp-cron.php via a real system cron instead — this filter is mostly relevant when you still rely on WordPress's own self-ping.

Used in

Smart FAQ Management

4WP FAQ

Not just another FAQ block. A smart wrapper that adds intelligence
without breaking your design.

Schema JSON-LD

Zero Duplication

Content-First

FSE Hub