diff --git a/includes/content-filters.php b/includes/content-filters.php new file mode 100644 index 0000000..e400c71 --- /dev/null +++ b/includes/content-filters.php @@ -0,0 +1,47 @@ +ID ) || is_admin() ) { + return $permalink; + } + + if ( !$recursing ) { + if ( isset( $post->post_status ) && ( 'future' === $post->post_status ) ) { + $post->post_status = 'publish'; + $recursing = true; + return get_permalink( $post, $leavename ) ; + } + } + + $recursing = false; + return $permalink; +} +add_filter( 'post_link', 'tni_core_future_permalink', 10, 3 ); +add_filter( 'post_type_link', 'tni_core_future_permalink', 10, 4 ); diff --git a/includes/utilities.php b/includes/utilities.php index d128a46..5847022 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -8,23 +8,10 @@ * @license GPL-2.0+ */ - /** - * Run Once - * Runs function once - * * - * @since 1.0.0 - */ - if ( isset( $_GET['run_tni_copy_custom_fields'] ) && ! get_option( 'tni_copy_custom_fields_complete' ) ) { - add_action( 'init', 'tni_copy_custom_fields', 10 ); - add_action( 'init', 'tni_copy_custom_fields_finished', 20 ); - } elseif ( isset( $_GET['run_tni_copy_custom_fields'] ) && get_option( 'tni_copy_custom_fields_complete' ) ) { - die( "Script already run." ); - } - /** * Copy Custom Fields * Copies meta field data from `_additional_content_*` fields to new custom fields - * @usage http://yourdomain.com/?run_tni_copy_custom_fields + * @usage run using WP-CLI `wp eval 'tni_copy_custom_fields();'` * * @since 1.0.0 * @@ -58,7 +45,6 @@ function tni_copy_custom_fields() { } } - add_action( 'init', 'tni_copy_custom_fields', 10 ); /** * Set Guest Account Roles @@ -107,13 +93,3 @@ function tni_core_assign_guest_author_roles() { echo "DONE"; } - - /** - * Add `tni_copy_custom_fields_complete` Once Function is Run - * - * @since 1.0.0 - */ - function tni_copy_custom_fields_finished() { - add_option( 'tni_copy_custom_fields_complete', 1 ); - die( "Script finished." ); - } diff --git a/readme.txt b/readme.txt index cd66fb8..1d91491 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: misfist Tags: custom Requires at least: 4.7 -Tested up to: 4.7.4 -Version: 1.2.3 +Tested up to: 4.7.5 +Version: 1.2.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -22,6 +22,9 @@ This section describes how to install the plugin and get it working. == Changelog == += 1.2.4 May 18, 2017 = +* #66 {https://github.com/thenewinquiry/tni-theme/issues/66} - Fix permalink for `future` posts + = 1.2.3 May 10, 2017 = * #23 - Added hide featured image checkbox field to blogs. diff --git a/tni-core-functionality.php b/tni-core-functionality.php index 690801a..bd8b4d6 100644 --- a/tni-core-functionality.php +++ b/tni-core-functionality.php @@ -10,7 +10,7 @@ * Text Domain: tni-core * Domain Path: /languages * - * Version: 1.2.3 + * Version: 1.2.4 * * @package Tni_Core_Functionality */ @@ -26,6 +26,7 @@ define( 'TNI_CORE_DIR_URL', plugin_dir_url( __FILE__ ) ); require_once( 'includes/helpers.php' ); +require_once( 'includes/content-filters.php' ); require_once( 'includes/template-tags.php' ); // Load plugin class files @@ -42,7 +43,6 @@ // Load admin files require_once( 'admin/class-tni-core-admin.php' ); - require_once( 'includes/utilities.php' ); /** @@ -52,7 +52,7 @@ * @return object Tni_Core */ function Tni_Core() { - $instance = Tni_Core::instance( __FILE__, '1.2.3' ); + $instance = Tni_Core::instance( __FILE__, '1.2.4' ); return $instance; }