Skip to content

Instantly share code, notes, and snippets.

@kristarella
Created April 3, 2018 03:55
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 kristarella/944d10af31d02aece850826d3420c653 to your computer and use it in GitHub Desktop.
Save kristarella/944d10af31d02aece850826d3420c653 to your computer and use it in GitHub Desktop.
This plugin removes location data from posts published between the start and end dates.You can delete lines 14, 15, 16, 18 and 20 if you want to remove location from all posts.
<?php
/*
Plugin Name: Exif remove location
Description: Hide the location from Exifography for certain dates
Version: 20180403
Author: kristarella
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
/* removes location as a field between the start and end dates */
function exif_unset_location($fields) {
global $post;
$start_date = strtotime( '2017-11-01' );
$end_date = strtotime( '2017/11/29' );
$post_date = strtotime( $post->post_date );
if ($post_date > $start_date || $post_date < $end_date) {
unset($fields['location']);
}
return $fields;
}
add_filter('exifography_display_exif','exif_unset_location');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment