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
#!/bin/bash | |
# Bash script to set up local site using LAMP on Ubuntu | |
# Requires Apache2, MySQL, mkcert (https://github.com/FiloSottile/mkcert) | |
# See also sitedrop.sh https://gist.github.com/jonattanbossenger/4950e107b0004a8ee82aae8b123cce58 | |
# This version improved by @haydar on github | |
if [[ $EUID -ne 0 ]]; | |
then |
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 | |
add_filter( 'wp_unique_post_slug', 'cpt_unique_slug_by_tax', 10, 6 ); | |
function cpt_unique_slug_by_tax( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { | |
if ( 'guide' === $post_type ) { | |
global $wpdb; | |
$post_tax = get_the_terms( $post_ID, 'guide_cat' ); | |
// Check if another CPT exists in the same taxonomy with the same name. |