WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9039 closed enhancement (worksforme)

Need a method to cancel post save and/or status change

Reported by: sirzooro Owned by:
Milestone: 2.7.1 Priority: normal
Severity: normal Version: 2.7
Component: General Keywords:
Focuses: Cc:

Description

I have a site where everyone can register and submit post for review. Each post must conform to set of rules. I want to write plugin to check some of them (namely minimum post length and maximum number of outgoing links). Unfortunately the only way to do this in current WP version is via core files hacking, because existing actions fires after post is saved or its status is changed. Could you add new action(s) which will fire before post is saved and before post status change, so I have a chance to cancel these actions?

Change History (2)

comment:1 in reply to: ↑ description filosofo5 years ago

Replying to sirzooro:

I want to write plugin to check some of them (namely minimum post length and maximum number of outgoing links). Unfortunately the only way to do this in current WP version is via core files hacking, because existing actions fires after post is saved or its status is changed.

You should be able to use the wp_insert_post_data filter: if you interrupt at that point, no posts database changes should be made.

comment:2 sirzooro5 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Thanks. With this filter and few other actions (save_post, admin_notices, admin_menu) I have been able to create my plugin.

Note: See TracTickets for help on using tickets.