Hello!
You can shoot yourself in the foot by realizing this: TSF’s structured data markup is outputted first so that Google renders it leading. Any (conflicting) markup thereinafter the document (often from themes) is marked supplementary and might get discarded.
Before working with filters, please read our filter guide. Primarily, you tried to use a filter name as an action callback; this incites errors.
And then, before you continue, I implore you to read into Structured Data: https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data.
With that said, to achieve what you wish, you must first overwrite the structured data with an empty string:
add_filter( 'the_seo_framework_ldjson_scripts', '__return_empty_string' );
Then, you must call the_seo_framework()->render_ld_json_scripts() in the footer.
Please bear in mind that custom development is not within the scope of TSF support forums. I ask you to hire a developer if you wish to continue.
-
This reply was modified 4 years, 7 months ago by
Sybre Waaijer. Reason: Clairty
Thank you, I check your reply every day.
Can you help me complete it, maybe there will be many people who need it.
I like your seo plugin, so I have migrated from another plugin, I am learning to use many of these great features, I will buy soon to get to use more special functions not to be missed.
Hi again!
I’ll entertain the idea, but I do not recommend anyone implementing this filter, for it will probably break in a future update — nor do I believe it expedites a practical result.
add_filter( 'the_seo_framework_ldjson_scripts', '__return_empty_string' );
add_action( 'wp_footer', function() {
if ( function_exists( 'the_seo_framework' ) )
echo the_seo_framework()->render_ld_json_scripts() ?: '';
} );
I hope that is what you’re seeking. To reiterate, this level of support is out of scope, so I still recommend getting in touch with a developer if you want to customize it further.
Cheers 🙂
Wow, worked fine.
First time I know this “add_action” type.
Thanks for helping me out of plan
Good health bro
-
This reply was modified 4 years, 7 months ago by
minhduc.dev.