Last active
April 3, 2018 07:17
-
-
Save kristarella/7c8aaa7c5616cd0d85649176cf4e7ce2 to your computer and use it in GitHub Desktop.
This plugin is for use with the Exifography plugin. It removes location data from posts published between the start and end dates; it saves you having to update the metadata for the posts in the database. You can delete lines 14, 15, 16, 18 and 20 if you want to remove location from all posts.
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 | |
/* | |
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-01-01' ); | |
$end_date = strtotime( '2017-12-31' ); | |
$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