[wp-trac] [WordPress Trac] #37580: Users who cannot set the Front page or Posts page should not be able to delete these pages

WordPress Trac noreply at wordpress.org
Fri Aug 5 09:35:51 UTC 2016


#37580: Users who cannot set the Front page or Posts page should not be able to
delete these pages
--------------------------------------+------------------------------
 Reporter:  JakePT                    |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Role/Capability           |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:  administration
--------------------------------------+------------------------------

Comment (by JakePT):

 @Kenshino In map_meta_cap is seems fairly trivial to just set it to
 manage_options if the post in question is the front page or posts page:
 {{{#!php
 <?php
 case 'delete_page':
 ...
         if ( get_option( 'page_for_posts' ) == $post->ID ) {
                 $caps[] = 'manage_options';
                 break;
         }

         if ( get_option( 'page_on_front' ) == $post->ID ) {
                 $caps[] = 'manage_options';
                 break;
         }
 }}}
 But that doesn't provide any explanation to the user about why, and
 doesn't account for the ability to unpublish the pages by setting to
 draft, private etc.

 I'm not 100% sure that either are necessary, but worth considering I
 think.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37580#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list