Support » Plugin: Rank Math SEO with AI SEO Tools » Exclude this attachment from sitemap

  • Resolved Anonymous User 18296540

    (@anonymized-18296540)


    Exclude this attachment from sitemap – such a check box appears with every image, even when using it for a user with privileges other than admin. Even the Role Manager Add-on in RM does not turn it off. There shouldn’t be this check box for everyone – it should only be for the admin. Anyone can now click and exclude any image from the sitemap, even by mistake.

Viewing 1 replies (of 1 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @schuerich,

    Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.

    This can be improved for sure. We can show this option only to the admins or to the users that can edit the On-Page General Settings. We have informed this internally and it will be added to the plugin in one of the upcoming updates.

    For now, please add tghe following code in functions.php file to remove this field for all the user roles except admin:

    add_filter( 'attachment_fields_to_edit', function( $form_fields, $post ) {
    	if ( empty( $form_fields['rank_math_exclude_sitemap'] ) || current_user_can( 'manage_options' ) ) {
    		return $form_fields;
    	}
    
    	unset( $form_fields['rank_math_exclude_sitemap'] );
    
    	return $form_fields;
    }, 21, 2 );

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude this attachment from sitemap’ is closed to new replies.