Last active
April 30, 2020 19:57
-
-
Save jtsternberg/6148635 to your computer and use it in GitHub Desktop.
Cut off instagram imported titles to certain number of words.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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