Skip to content

Instantly share code, notes, and snippets.

@MogulChris
MogulChris / wpdump.bash
Last active February 27, 2019 02:03 — forked from cyberhobo/wpdump.bash
Bash alias for mysqldump using credentials from a wp-config.php file
#!/bin/bash
# one argument: the directory of a wp-config.php file
wpconfig=$1/wp-config.php
if [ ! -f "$wpconfig" ]; then
echo "$wpconfig not found."
exit
fi
@MogulChris
MogulChris / custom-acf-admin.js
Last active August 7, 2023 06:25 — forked from ChrisWebbNZ/hierearchical-select-acf.php
Hierarchical select for native Advanced Custom Fields taxonomy fields.
jQuery(document).ready(function($){
//Modify select2 ajax request to include a parent_id parameter, used by custom_acf_taxonomy_hierarchy()
acf.add_filter('select2_ajax_data', function( data, args, $input, field, instance ){
var target_field_key = 'field_5c7634ca3413f'; //YOUR TARGET FIELD KEY HERE
if(data.field_key == target_field_key){
var parent_id = 0; //by default we want terms with parent of 0 (top level)