Hello,
Thank you for your query and we are so sorry about the trouble this must have caused.
In your initial filter code, it seems that you’re trying to remove the WebPage
and mainEntityOfPage
properties. Please refer to this code instead and see if that would work:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
unset($data['WebPage']);
foreach ( $data as $key => $entity ) {
if ( isset($entity['mainEntityOfPage']) ) {
unset( $data[ $key ]['mainEntityOfPage'] );
}
}
return $data;
}, 99, 2);
If you wish to modify only the JobPosting schema, you can do so by using this filter hook:
add_filter( 'rank_math/snippet/rich_snippet_jobposting_entity', function( $entity ) {
return $entity;
});
Looking forward to helping you.
After adding this code to the theme’s functions.php
file, the issue remains unresolved.
Hello,
Please share the affected URL here so we can take a closer look from our end.
Looking forward to helping you.
Hello,
We can see that the WebPage
schema is already removed except for the mainEntityOfPage
.
Please try the following code instead:
add_filter( 'rank_math/snippet/rich_snippet_jobposting_entity', function( $entity ) {
unset($entity['mainEntityOfPage']);
return $entity;
});
Let us know how that goes.
After adding this `add_filter( ‘rank_math/snippet/rich_snippet_jobposting_entity’, function( $entity ) {
unset($entity[‘mainEntityOfPage’]);
return $entity;
});` code to the theme’s functions.php file, the issue persists.
I am already using the following code to remove unnecessary schema elements from the job posting.
Please ensure that the job postings only display the appropriate job schema.
After implementing the following code, my website traffic increased by 50%. Additionally, after unsetting the specified entities, all job postings now appear correctly in Google’s job posting schema results.
// Remove 'mainEntityOfPage' or schemas ending with '#webpage'
if (
(isset($schema['mainEntityOfPage']['@id']) && strpos($schema['mainEntityOfPage']['@id'], '#webpage') !== false) ||
(isset($schema['@id']) && strpos($schema['@id'], '#webpage') !== false)
) {
unset($data[$key]);
continue;
}
// Remove 'image' property from steps if present
if (isset($schema['step'])) {
foreach ($schema['step'] as &$step) {
if (isset($step['image'])) {
unset($step['image']);
}
} } }
return $data;
}, 50);
// Remove the "Jobs" breadcrumb
foreach ($crumbs as $key => $crumb) {
if (isset($crumb[1]) && $crumb[1] === $jobs_url) {
unset($crumbs[$key]);
}
}
return array_values($crumbs); // Reindex the array
}, 10, 2);
I want to remove only this section, but despite my efforts, I haven’t been able to remove it yet.
Want to remove just this Section
Hello,
Please add this filter to remove the imageObject property from the schema:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
unset($data['ImageObject']);
return $data;
}, 99, 2);
Once done, clear your website’s cache and check again.
Looking forward to helping you.
after clear cache of Local host and CDN this code Not Working
Hello,
In this case, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.