Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Unique Title Checker Across Post Types
*
* @package unique-title-checker-across-post-types
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Unique Title Checker Across Post Types
* Plugin URI: https://gist.github.com/2ndkauboy/fe42bb2815499a8ad38a3b5403ecd57a
* Description: Changes the query for the "Unique Title Checker" plugin to check for duplicate title in any post type
* Version: 1.0.0
* Author: Bernhard Kau
* Author URI: http://kau-boys.de
* Text Domain: unique-title-checker-across-post-types
* License: GPLv3
* License URI: http://www.gnu.org/licenses/gpl-3.0
*/
/**
* Remove the filter on the post type so the uniqueness is checked against all post types.
*
* @param array $args The WP_Query arguments for the uniqueness query.
*
* @return array
*/
function unique_title_checker_across_post_types_arguments( $args ) {
unset( $args['post_type'] );
return $args;
}
add_filter( 'unique_title_checker_arguments', 'unique_title_checker_across_post_types_arguments' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment