Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Last active April 30, 2020 19:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtsternberg/6148635 to your computer and use it in GitHub Desktop.
Save jtsternberg/6148635 to your computer and use it in GitHub Desktop.
Cut off instagram imported titles to certain number of words.
<?php
function dsgnwrks_qa_make_title_excerpted( $import ) {
if ( isset( $import['post_title'] ) ) {
// feel free to edit these 2 values
$number_of_words = 5;
$more = '...';
$import['post_title'] = wp_trim_words( $import['post_title'], $number_of_words, $more );
}
return $import;
}
add_filter( 'dsgnwrks_instagram_pre_save', 'dsgnwrks_qa_make_title_excerpted' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment