• Resolved YuMyo

    (@nikho)


    Hi,

    is there ay filter/hook to change the value of a schema field?

    For example, say we’re not using the WP User as Post Author but a custom field instead. It would be useful being able to change the author value without messing with plugin’s core files.

    https://www.ads-software.com/plugins/schema/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Hesham Zebida

    (@hishaman)

    Indeed, you can override post author name with something like in your Theme’s functions.php file:

    function change_author_name_12345( $json ) {
    
    	$json['author']['author_name'] = 'New Author Name';
    	return $json;
    
    }
    add_filter('schema_json', 'change_author_name_12345');

    I hope this helps.

    P.S. Please, rate the plugin if you find it useful.

    Plugin Author Hesham Zebida

    (@hishaman)

    I will mark this as solved since I didn’t hear back from you!

    Thread Starter YuMyo

    (@nikho)

    Yes, thank you very much @hesham Zebida

    Plugin Author Hesham Zebida

    (@hishaman)

    You are welcome.

    I appreciate if you rate the plugin ??

    Thread Starter YuMyo

    (@nikho)

    Done!

    However, the above filter seems to run in individual posts but not for categories. Is that right?

    Thread Starter YuMyo

    (@nikho)

    Correction: the filter seems to run in individual posts and categories but not archives or custom post type archives

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Any Filter/hook ?’ is closed to new replies.