• Dear Nate,

    How are you doing?

    Again, I am here with an issue and seeking your help. If you have some time, please consider this as an urgent one. I know you do your best always.

    The issue is with W3C Validator for [contact-card] shortcode multiple location. I am getting and error with schema.

    The error message is – “The itemtype attribute must not be specified on elements that do not have an itemscope attribute specified.”

    The error code is – <meta itemprop="parentOrganization" itemtype="https://schema.org/Restaurant" content="Restaurant Name">

    Is there any way I can remove the parent organization meta tag? Or if you have any other solution, I will be happy.

    Thank you. Take care.
    -Amit

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @amitbiswas06,

    This is related to the multi-location feature. The meta tag is output in location schema to indicate the parent organization.

    Can you share a link to the site where you’re getting the validation error? I’ll take a look and see if I can spot what’s going on.

    If it’s urgent, you can overwrite the bpfwp_print_parent_organization function to remove the meta tag:

    https://github.com/NateWr/business-profile/blob/master/includes/template-functions.php#L598-L620

    But I don’t know if this will have any negative side-effects to how Google links the locations of your business.

    Thread Starter Amit Biswas

    (@amitbiswas06)

    Thanks for the reply. I have tested it locally. For now, I will make the changes in actual plugin file. But if possible, can you make any filter to that function?

    Thanks!
    -Amit

    Hi Amit,

    That function is “pluggable” which means that if you create the same plugin in your theme or a custom plugin, it should override the one in my plugin.

    Thread Starter Amit Biswas

    (@amitbiswas06)

    Dear Nate,

    Thanks for your help. Unfortunately I am a fatal error when trying to override the function – bpfwp_print_parent_organization()

    Error message – “Fatal error: Cannot redeclare bpfwp_print_parent_organization() (previously declared in C:\….

    I am using this function in one of my custom plugin. I have also tried to use it in theme’s functions.php file, but it’s getting same error.

    I am sure I am missing something that you can light on ??

    If you can help, it will be great as always.

    Thanks,
    Amit

    Ah, it’s probably an issue with the load order. The other approach I’d recommend is to hook into the callbacks array and remove the callback for the parent organization:

    https://github.com/NateWr/business-profile/blob/master/includes/template-functions.php#L106-L117

    Thread Starter Amit Biswas

    (@amitbiswas06)

    Dear Nate,

    You are really great! I have now solved this issue with your help. Final code is –

    if ( !function_exists( 'themedomain_bp_contact_card_filter' )){
    	
    	function themedomain_bp_contact_card_filter( $data ) {
    		if ( isset( $data['parent_organization'] ) ){
    			unset( $data['parent_organization']);
    			return array_filter( $data );
    		}
    	}
    	
    	add_filter( 'bpwfwp_component_callbacks', 'themedomain_bp_contact_card_filter' );
    }

    Let me know if the above code has no issue. This is working nicely in my theme though.

    Thanks!
    Amit

    Yep, that’s exactly how I’d do it!

    I still need to run some tests to figure out if the schema issue is general or located to your particular config. I’ve flagged that issue here if you want to follow progress:

    https://github.com/NateWr/business-profile/issues/77

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Schema Issue – W3C Error!’ is closed to new replies.