Filter to Remove Link From Featured Images on Blog Page

No results found. Try again with different words?

Search must be at least 3 characters.

Filter to Remove Link From Featured Images on Blog Page

Do you see the default link on the Featured Image of the Posts on Blog Page?

Why?

The Featured Images added to each post are set a link to the same post.

How to clear?

From the Astra Theme version – 2.2.2 we providing a filter using which the link to the post can be removed.

Filter: The filter has been added to remove the featured image link on the blog page.

/**
  * Remove HTML before tag for link.
  * @param string $markup markup of post.
  * @return string
  */
function astra_remove_link_before( $markup ) {
    $markup = __return_empty_string();
    return $markup;
}

/**
  * Remove HTML after tag for link.
  * @param string $markup markup of post.
  * @return string
  */
function astra_remove_link_after( $markup ) {
    $markup = __return_empty_string();
    return $markup;
}

add_filter( 'astra_blog_post_featured_image_link_before', 'astra_remove_link_before' );
add_filter( 'astra_blog_post_featured_image_link_after', 'astra_remove_link_after' );

Note: Add the above filter to your child theme’s functions.php, here’s an article to help you Add Custom code.

Was this article helpful?
Did not find a solution? We are here to help you succeed.

Related Docs

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.