shauny
Forum Replies Created
-
Forum: Plugins
In reply to: [Media File Renamer: Rename for better SEO (AI-Powered)] Hide From RenameI would also like a way to remove things from “Never Renamed”
There are lots of files which already have the perfect name, but they are cluttering up the “Never Renamed” section because they have never been renamed.
I don’t want to have to manually lock each one. And I don’t want it to scan through them every time I do a bulk rename.
Is there any plans to fix this?
It was not resolved. I was unable to post the PHP code, but don’t need to because by looking at the plugin code I can see that filter runs *before* the avatar is updated so it will always return the previous value!
Pretty rude to mark things as resolved when there are clearly bugs.
I’ve just tried this and it doesn’t work because it returns the old avatar, each time I change my avatar it is returning the previous file!
Is there any way to ensure it gets the very latest avatar?
Thanks I’ll take a look. Is this documented anywhere?
Is there a similar hook for the cover photo?
Nevermind, it was another plugin messing things up…
Hey,
That would be great if you could touch it up for me. I didn’t know I’d need is_singular, thanks.
Shaun
Thanks for this!
I’ve adapted it to work with single posts as well, as for certain post types I use a “synopsis” field to store the content, so it should get it from there. This all seems to work, is it OK do you think?
(Is any of this documented, or is it best to read the source code of the plugin? None of these filters or functions are on the documentation on your site)
add_filter( 'the_seo_framework_generated_description', 'my_tsf_generated_description', 10, 2 ); /** * @param string $desc The generated description. * @param array|null $args The query arguments. Contains 'id', 'tax', 'pta', and 'uid'. * Is null when the query is auto-determined. * @return string The overwritten description. */ function my_tsf_generated_description( $desc, $args ) { if ( ! function_exists( 'get_field' ) ) return $desc; if ( isset( $args ) ) { // Custom query, such as for the SEO Bar. if ( 'term' === The_SEO_Framework\get_query_type_from_args( $args ) ) { $term = get_term( $args['id'], $args['tax'] ); } // Detect single post if ( 'single' === The_SEO_Framework\get_query_type_from_args( $args ) ) { $postID = $args['id']; } } else { // On the front-end. if ( tsf()->query()->is_editable_term() ) { $term = get_queried_object(); } elseif ( tsf()->query()->is_single() ) { $postID = get_the_ID(); } } // POST, for posts if ( ! empty( $postID ) && ! is_wp_error( $postID ) ) { // Fall back to generated description if no description is set via the post's custom field. $desc = strip_tags(get_field( 'synopsis', $postID )) ?: $desc; } // TERM, for archives if ( ! empty( $term ) && ! is_wp_error( $term ) ) { // Fall back to generated description if no description is set via the term's custom field. $desc = strip_tags(get_field( 'description', $term )) ?: $desc; } return $desc; }
With some trial and error I think I’ve figured this out. Please let me know if there are any issues doing it this way or if there is a better way!
// SEO Framework - descriptions function my_seo_framework_description($description, $args) { $queriedObj = get_queried_object(); if($queriedObj instanceof WP_Term) { if($desc = get_field('description', $queriedObj)) { $description = $desc; } } return $description; } add_filter('the_seo_framework_custom_field_description', 'my_seo_framework_description', 10, 2); add_filter('the_seo_framework_generated_description', 'my_seo_framework_description', 10, 2);
I can provide a copy of the plugin for testing if that helps.
That code worked, thanks (I realised I said the wrong thing – not custom post type archives but custom taxonomy archives, so I switched it to is_tax and that works).
I’ve also emailed BoldThemes support and asked them to reach out to you for integration! Fingers crossed.
Thanks I will try this out later.
The plugin does support lots of SEO plugins including the usual ones like Yoast, but no support for yours I’m afraid ??Edit: Nevermind, I found the plugin at fault. It is a premium plugin called MightyShare.
- This reply was modified 9 months, 1 week ago by shauny.
Okay thanks, I’ll take another look when I can and will try searching the plugins. I don’t use any of those though. The custom filter would be amazing if you get around to doing it!
Thanks a lot!
Forum: Plugins
In reply to: [ActivityPub] How to update further meta?Thanks for those, any tips on how to test this if I’m running my site locally and want to make changes? Then how to test it with such aggressive cache for when I make the changes live?