Skip to content

Instantly share code, notes, and snippets.

@anwas
anwas / functions.php
Created October 27, 2020 07:48 — forked from justlevine/functions.php
cpt_unique_slug_by_tax.php
<?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.
@anwas
anwas / sitesetup.sh
Created July 15, 2021 02:19 — forked from haydar/sitesetup.sh
Bash script to automatically provision LAMP sites
#!/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