• Resolved minhduc.dev

    (@ducpl)


    Since my site needs to unify the “schema” under the footer, is there any way to move it below the footer,
    I did a lot of research on “the_seo_framework_receive_json_data” but to no avail.
    Thanks

    add_action('wp', function() {
        remove_action( 'wp_head', 'the_seo_framework_receive_json_data', -999 );
        add_action( 'wp_footer', 'the_seo_framework_receive_json_data', 99999 ); 
        }
    );
    • This topic was modified 3 years, 1 month ago by minhduc.dev.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    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 3 years, 1 month ago by Sybre Waaijer. Reason: Clairty
    Thread Starter minhduc.dev

    (@ducpl)

    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.

    Plugin Author Sybre Waaijer

    (@cybr)

    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 ??

    Thread Starter minhduc.dev

    (@ducpl)

    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 3 years, 1 month ago by minhduc.dev.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘please help “schema”’ is closed to new replies.