wpseek.com
A WordPress-centric search engine for devs and theme authors
block_core_paragraph_add_class › WordPress Function
Since7.0.0
Deprecatedn/a
› block_core_paragraph_add_class ( $block_content )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Append the `wp-block-paragraph` class before rendering the stored `core/paragraph` block contents.
For example, the following block content:Hello World
Would be transformed to:Hello World
Source
function block_core_paragraph_add_class( $block_content ) {
if ( ! $block_content ) {
return $block_content;
}
$processor = new WP_HTML_Tag_Processor( $block_content );
if ( $processor->next_tag( 'p' ) ) {
$processor->add_class( 'wp-block-paragraph' );
}
return $processor->get_updated_html();
}