Open strarsis opened 5 years ago
That's a Gutenberg bug. The REST-API search endpoint intentionally uses get_the_title()
to retrieve the "rendered" title attribute. They should either strip the tags themselves or not escape the value.
@mundschenk-at: Would you recommend that I create an issue in the Gutenberg issue tracker for this?
Only if it still happens with the current development release of the Gutenberg plugin, otherwise it should be reported in the WordPress.org trac. I can't say how quickly it will be fixed (so I may create a workaround in the next release anyway), but it should be reported there.
@strarsis Have you opened a ticket?
@mundschenk-at: No, I haven't yet. I have been unsure whether you or me should create it. 😸
@strarsis Feel free to create the ticket. I'll comment with any follow-up information.
Now I encountered this issue, too, in a different context. I use the_title
filter to add something to the markup that the Latest Posts Gutenberg core block uses (server-side rendering). In the autocomplete this markup crops up, even when using if(is_admin()) return $title; // skip
.
Probably because the REST API is its own thing, and Gutenberg uses the rendered
attribute value from the JSON response.
@mundschenk-at: Any workaround for this until Gutenberg fixes this issue? I use the filter in the theme, it should not interfere with the backend.
@mundschenk-at: Any workaround for this until Gutenberg fixes this issue? I use the filter in the theme, it should not interfere with the backend.
You can use the typo_content_filters
filter to unset the heading
filter and use \WP_Typography::filter( $title, true )
in your templates (where appropriate).
Issue Overview
In Gutenberg editor the URL autocomplete for links shows escaped markup for typography (e.g.
<span class="amp">&</span>
). Either the raw HTML markup should be somehow injected (so it is not escaped) or the page names shouldn't be filtered at all.Steps to Reproduce (for bugs)
&
is a good example as this should be handled by default).Expected Behavior
No escaped HTML in URL autocompletion.
Current Behavior
Escaped HTML in URL autocompletion.
Possible Solution
Related Issues and/or PRs
https://github.com/mundschenk-at/wp-typography/issues/229