Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: import_post_added

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

Line Code
537           if ( $postmeta) { foreach ($postmeta as $p) {
538                $key   = $this->get_tag( $p, 'wp:meta_key' );
539                $value = $this->get_tag( $p, 'wp:meta_value' );
540                $value = stripslashes($value); // add_post_meta() will escape.
541
542                $this->process_post_meta($post_id, $key, $value);
543
544           } }
545
546           do_action('import_post_added', $post_id);
547           print "</li>\n";
548      }
549
550      function process_post_meta($post_id, $key, $value) {
551           // the filter can return false to skip a particular metadata key
552           $_key = apply_filters('import_post_meta_key', $key);
553           if ( $_key ) {
554                add_post_meta( $post_id, $_key, $value );
555                do_action('import_post_meta', $post_id, $_key, $value);