Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at a plugin to add scheduled posts to the internal linking…
… dialog in WordPress
- Loading branch information
0 parents
commit d511cae
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/* | ||
Plugin Name: Internal Linking for Scheduled Posts | ||
Description: Add scheudled posts to the internal linking dialog in the WordPress editor. | ||
Version: 1.0 | ||
Author: Evan Solomon | ||
Author URI: http://evansolomon.me | ||
*/ | ||
|
||
/** | ||
* Copyright (c) 2012 Evan Solomon. | ||
* | ||
* Released under the GPL license | ||
* http://www.opensource.org/licenses/gpl-license.php | ||
* | ||
* This is an add-on for WordPress | ||
* http://wordpress.org/ | ||
* | ||
* ********************************************************************** | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* ********************************************************************** | ||
*/ | ||
|
||
|
||
function es_internal_linking_for_scheduled_posts( $query ) { | ||
// Make sure this is a requent for internal linking | ||
if ( ! isset( $_POST ) || ! isset( $_POST['action'] ) || 'wp-link-ajax' != $_POST['action'] ) | ||
return false; | ||
|
||
// Add scheduled posts to the query | ||
$post_status = (array) $query->query_vars['post_status']; | ||
$post_status[] = 'future'; | ||
$query->set( 'post_status', $post_status ); | ||
} | ||
add_action( 'pre_get_posts', 'es_internal_linking_for_scheduled_posts' ); |