Skip to content

Instantly share code, notes, and snippets.

@moimikey
Created December 16, 2011 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moimikey/1487428 to your computer and use it in GitHub Desktop.
Save moimikey/1487428 to your computer and use it in GitHub Desktop.
Filtering WordPress output
<?php
/**
* Filter get_post() array with only the relative information that we need
*
* @access public
* @param integer $post_id
* @return array
* @author moimikey
*/
function hertzberg_filter_post_data( $post_id ) {
$output = array();
$post = get_post( $post_id );
$filter = new stdClass;
$filter->ID = $post->ID;
$filter->post_title = $post->post_title;
$filter->guid = $post->guid;
$filter->post_date = $post->post_date;
$output[] = $filter;
return $output;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment