Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make instagram imported posts' titles to be the date of the imported image
<?php
/*
Plugin Name: DsgnWrks Instagram Importer - Make Title the Image Date
Plugin URI: http://dsgnwrks.pro/plugins/dsgnwrks-instagram-importer
Description: Set the title of your instagram posts to the date the image was taken
Author URI: http://dsgnwrks.pro
Author: DsgnWrks
Donate link: http://dsgnwrks.pro/give/
Version: 0.1.0
*/
function dsgnwrks_qa_make_title_image_date( $import, $insta_image ) {
if ( isset( $import['post_title'] ) ) {
// http://php.net/manual/en/function.date.php
$date_format = 'Y-m-d H:i:s';
$import['post_title'] = date( $date_format, $insta_image->created_time );
}
return $import;
}
add_filter( 'dsgnwrks_instagram_pre_save', 'dsgnwrks_qa_make_title_image_date', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.