Opened 16 years ago
Closed 14 years ago
#14283 closed enhancement (fixed)
Add a new action, fired when a post is added via XMLRPC
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.4 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | XML-RPC | Keywords: | 3.2-early has-patch commit |
| Focuses: | Cc: |
Description
Currently when you want to manipulate a new post which has been added over XMLRPC after the attachments have been added, there is no action to neatly hook. (Attachments are assigned to their parent via $wpdb queries, and no further actions or hooks appear to be triggered after the attachments have been added.) This patch suggests a new hook which fires at the end of the mw_newPost method.
Not sure about the name "xmlrpc_post_new_post" (post new post is meant to refer to "after a new post").
If this patch is acceptable perhaps it's worth adding similar actions to mw_editPost, 'mw_newPage, and mw_editPage`, etc.
Attachments (2)
Change History (9)
#2
@
15 years ago
- Keywords needs-patch 3.2-early added; has-patch removed
- Owner set to westi
- Status changed from new to accepted
This sounds reasonable.
We should probably add hooks at the end of all the relevant XML-RPC functions for posts/pages.
Naming scheme and format something like:
do_action('xmlrpc_call_sucess_blogger_newPost', $post_ID, $args);
Moving to 3.2-early
#3
@
15 years ago
- Keywords changed from needs-patch, 3.2-early to needs-patch 3.2-early
I like the idea, so I'm submitting a patch that adds an action hook to:
- wp.deletePage
- blogger.newPost
- blogger.editPost
- blogger.deletePost
- mw.newPost
- mw.editPost
These are all the relevant post/page methods where this kind of hook makes sense. The wp methods for editing and creating posts just direct to mw_editPost() and mw_newPost() anyway, so they'll end up using the same hooks.
I'm using westi's proposed schema as well:
do_action( 'xmlrpc_call_success_{method name}', $post_ID, $args );
We might want to consider adding similar hooks for comments and media calls, but that would be another ticket ...
Adds a new action to XMLRPC after a new post has been added