Filter to Remove Link From Featured Images on Blog Page
|
/ Documentation /Custom Code Snippets/Blog Filters/ Filter to Remove Link From Featured Images on Blog Page

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 doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

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

This field is required.

REWIND

YEAR IN REVIEW

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.

Download Free Astra Theme - Modal Popup Form