Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: content_save_pre

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 4 times in this file.

Line Code
376
377        $post_status = ($publish) ? 'publish' : 'draft';
378
379        $post_author = $user_data->ID;
380
381        $post_title = xmlrpc_getposttitle($content);
382        $post_category = xmlrpc_getpostcategory($content);
383
384        $content = xmlrpc_removepostdata($content);
385        $post_content = apply_filters( 'content_save_pre', $content );
386
387        $post_date = current_time('mysql');
388        $post_date_gmt = current_time('mysql', 1);
389
390        $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
391
392        $post_ID = wp_insert_post($post_data);
393
394        if (!$post_ID) {
 
Line Code
435
436        extract($actual_post);
437
438        $content = $newcontent;
439
440        $post_title = xmlrpc_getposttitle($content);
441        $post_category = xmlrpc_getpostcategory($content);
442
443        $content = xmlrpc_removepostdata($content);
444        $post_content = apply_filters( 'content_save_pre', $content );
445
446        $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
447
448        $result = wp_update_post($postdata);
449
450        if (!$result) {
451             return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be edited.');
452        }
453
 
Line Code
517
518        $user_data = get_userdatabylogin($user_login);
519        if (!user_can_create_post($user_data->ID, $blog_ID)) {
520          return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');
521        }
522
523        $post_author = $user_data->ID;
524
525        $post_title = $content_struct['title'];
526        $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
527        $post_status = $publish ? 'publish' : 'draft';
528
529        $post_excerpt = $content_struct['mt_excerpt'];
530        $post_more = $content_struct['mt_text_more'];
531
532        $comment_status = (empty($content_struct['mt_allow_comments'])) ?
533          get_settings('default_comment_status')
534          : $content_struct['mt_allow_comments'];
535
 
Line Code
610        if (!user_can_edit_post($user_data->ID, $post_ID)) {
611          return new IXR_Error(401, 'Sorry, you can not edit this post.');
612        }
613
614        $postdata = wp_get_single_post($post_ID, ARRAY_A);
615        extract($postdata);
616           $this->escape($postdata);
617
618        $post_title = $content_struct['title'];
619        $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
620        $catnames = $content_struct['categories'];
621
622        $post_category = array();
623           
624        if (is_array($catnames)) {
625          foreach ($catnames as $cat) {
626            $post_category[] = get_cat_ID($cat);
627          }
628        }