[wp-trac] [WordPress Trac] #34706: Introduce an edit_post_{$post->post_type} action
WordPress Trac
noreply at wordpress.org
Wed Feb 28 21:55:35 UTC 2018
#34706: Introduce an edit_post_{$post->post_type} action
-------------------------------+------------------
Reporter: garrett-eclipse | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: Posts, Post Types | Version: 4.4
Severity: normal | Resolution:
Keywords: close | Focuses:
-------------------------------+------------------
Comment (by danieltj):
Replying to [comment:7 garrett-eclipse]:
> Thanks @Mte90 for taking this on, sorry I didn't take a stab at it
haven't had time outside of work since I had kids.
>
> The patch looks great.
>
> And I think the main benefit on this hook just like the save_post is to
allow for cleaner code without the post_type conditional check.
>
> An excerpt explaining from here;
> https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
> >NOTE: As of WP 3.7, an alternative action has been introduced, which is
called for specific post types: save_post_{post_type}. >Hooking to this
action you wouldn't have to check on the post type (ie: if ( $slug !=
$_POST['post_type'] ) in the sample above).
>
> Hope that's helpful in determining if this should push forward
All I'd say then is remove the blank line break immediately after the if
statement and this hook looks ready to go. My only concern was the number
of hooks already available due to the post object being available.
Feel free to remove the close tag, the patch itself is fine.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34706#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list