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 2 times in this file.

Line Code
526        }
527
528        $user = new WP_User(0, $user_login);
529        if ( !$user->has_cap('publish_posts') )
530          return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');
531
532        $post_author = $user->ID;
533
534        $post_title = $content_struct['title'];
535        $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
536        $post_status = $publish ? 'publish' : 'draft';
537
538        $post_excerpt = $content_struct['mt_excerpt'];
539        $post_more = $content_struct['mt_text_more'];
540
541        $comment_status = (empty($content_struct['mt_allow_comments'])) ?
542          get_settings('default_comment_status')
543          : $content_struct['mt_allow_comments'];
544
 
Line Code
608        $user = new WP_User(0, $user_login);
609        if ( !$user->has_cap('edit_post', $post_ID) )
610          return new IXR_Error(401, 'Sorry, you can not edit this post.');
611
612        $postdata = wp_get_single_post($post_ID, ARRAY_A);
613        extract($postdata);
614           $this->escape($postdata);
615
616        $post_title = $content_struct['title'];
617        $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
618        $catnames = $content_struct['categories'];
619
620        $post_category = array();
621           
622        if (is_array($catnames)) {
623          foreach ($catnames as $cat) {
624            $post_category[] = get_cat_ID($cat);
625          }
626        }