[wp-trac] [WordPress Trac] #17470: Display warning when editing the page_for_posts page
WordPress Trac
noreply at wordpress.org
Thu May 28 20:42:28 UTC 2015
#17470: Display warning when editing the page_for_posts page
-------------------------------+---------------------------------
Reporter: alexkingorg | Owner: helen
Type: enhancement | Status: closed
Priority: normal | Milestone: 4.2
Component: Posts, Post Types | Version: 3.2
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: ui, administration
-------------------------------+---------------------------------
Comment (by dougwollison):
Replying to [comment:22 philiparthurmoore]:
> Also, the logic here creates the disparate UX that I mentioned above.
Why not just always display the `_wp_posts_page_notice`, regardless of
content being there or not, and have the content box always available?
Seems much easier to deal with for themers who allow users to take
advantage of this on the front end of their sites. Thanks.
I agree, in fact once I saw the notice I decided it would be good to
incorporate that on pages that would be setup as index pages for custom
post types as well.
Honestly though I think this might be better as a hook on `edit_form_top`
or some other action which would take care of adding the notice and
disabling the editor if appropriate:
{{{
function _wp_maybe_disable_posts_page_editor( $post ) {
if ( $post->ID == get_option( 'page_for_posts' ) ) {
add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
if ( empty( $post->post_content ) ) {
remove_post_type_support( $post->post_type, 'editor' );
}
}
}
}}}
This way the hook could be removed if desired rather than adding another
hook that undoes the work. Minor difference but it feels more appropriate.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17470#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list