Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
Created December 28, 2019 10:40
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 2ndkauboy/fe42bb2815499a8ad38a3b5403ecd57a to your computer and use it in GitHub Desktop.
Save 2ndkauboy/fe42bb2815499a8ad38a3b5403ecd57a to your computer and use it in GitHub Desktop.
<?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