How to make the plugin compatible with Astra Pro plugin?

This article applies to any version of the plugin, release 2.0.0 or higher.

When enabling the add-on “Page headers” from the Astra Pro plugin, avatars do not show or they show incorrectly. That’s because Astra Pro plugin modifies how WordPress retrieves gravatars by default, making custom author avatars not being displayed correctly.

To fix that issue, we have included two hooks, so the only thing you have to do is to include this piece of code in your theme’s functions.php file:

add_action( 'molongui_authorship_before_get_guest_author_data', function()
{
    require_once WP_PLUGIN_DIR . '/astra-addon/' . 'addons/advanced-headers/classes/class-astra-ext-advanced-headers-markup.php';
    remove_filter( 'post_thumbnail_html', array( \Astra_Ext_Advanced_Headers_Markup::get_instance(), 'remove_post_thumbnail' ) );
});

add_action( 'molongui_authorship_after_get_guest_author_data', function()
{
    require_once WP_PLUGIN_DIR . '/astra-addon/' . 'addons/advanced-headers/classes/class-astra-ext-advanced-headers-markup.php';
    add_filter( 'post_thumbnail_html', array( \Astra_Ext_Advanced_Headers_Markup::get_instance(), 'remove_post_thumbnail' ) );
});

Did this article answer your question?