Site icon Hip-Hop Website Design and Development

How to add text before post_excerpt in Gutenberg

I’m trying to edit my plugin to work on the updated version of the website.

I have a custom plugin, which worked with plugin Post in Page but not working with the integrated function of Gutenberg – Newest posts.

Added text is not showing before posts excerpts listed by integrated function. That’s the problem I need help with. I didn’t find any other add_filter example than my used one.

So let me show you my previous working code and I’m asking how to convert it to work with a new editor integrated function to list posts:

This code is adding text hello world! before post excerpt.

add_action( 'template_redirect', 'kamzici_custom_fields_display_init' );
function kamzici_custom_fields_display_init() {
    if (get_post_type() === 'page')
        add_filter( 'the_excerpt', 'kamzici_custom_fields_display_content_filter', 20 );
}

function kamzici_custom_fields_display_content_filter( $content ) {
    $add_content = '<p>hello world!</p>';
    return $add_content.$content;
}

Is there any Gutenberg documentation, how to hook into it when I’m developing plugins? Just linking to documentation would help me a lot. Thank you.