Skip to content

Instantly share code, notes, and snippets.

@ashleyfae
Created January 10, 2017 17:39
Show Gist options
  • Save ashleyfae/5c86ac37ce6279da9991f0855d489133 to your computer and use it in GitHub Desktop.
Save ashleyfae/5c86ac37ce6279da9991f0855d489133 to your computer and use it in GitHub Desktop.
Always show post excerpts
<?php
/**
* Always show an excerpt.
*
* @param null|array|string $value The value get_metadata() should return - a single metadata value, or an array of values.
* @param int $post_id Object ID.
* @param string $meta_key Meta key.
* @param bool $single Whether to return only the first value of the specified $meta_key.
*
* @return bool|null|array|string
*/
function ag_rcp_always_show_excerpt( $value, $post_id, $meta_key, $single ) {
if ( 'rcp_show_excerpt' == $meta_key && $single ) {
return true;
}
return $value;
}
add_filter( 'get_post_metadata', 'ag_rcp_always_show_excerpt', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment