How to remove canonical url in wordpress? add_filter( ‘wpseo_canonical’, ‘__return_false’ ); not Working for me

In WordPress, there’s a function named redirect_canonical() which basically: Redirects incoming links to the proper URL based on the site URL. And by default, the function is hooked to template_redirect: add_action( ‘template_redirect’, ‘redirect_canonical’ ); So you can cancel/disable the default canonical redirects in WordPress like so: remove_action( ‘template_redirect’, ‘redirect_canonical’ ); However, if you’re just trying … Read more

Remove images from get_the_excerpt

If you read the Codex entry for get_the_excerpt(), you will find this: If the post does not have an excerpt, this function applies wp_trim_excerpt to the post content and returns that generated string with “[…]” at the end. wp_trim_excerpt is applied via the get_the_excerpt filter and can be removed. The wp_trim_excerpt() function: Generates an excerpt … Read more

Calling a custom excerpt function in a local loop

Note, the excerpt_length filter does not work like that. It takes one parameter, $length, which is the word length of the excerpt. Updated solution First we wire up the callback function wpse_default_excerpt_length() to the excerpt_length filter. This is our default excerpt length handler. Next, some additional excerpt_lengthcallback functions are declared, but we won’t wire them … Read more

Gallery images titles – get from post

Gallery Image Caption – As Title Of The Post It’s attached To Here’s one way to do it with a custom parent_titles attribute in the native gallery shortcode. This can be achieved by setting suppress_filters to false for the gallery query and modify the posts excerpts through the the_posts filter. We can then check for … Read more