Skip to content

Instantly share code, notes, and snippets.

@Bobz-zg
Created August 24, 2016 18:46
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 Bobz-zg/9cff6625c354ef3b8d46e0ece9242294 to your computer and use it in GitHub Desktop.
Save Bobz-zg/9cff6625c354ef3b8d46e0ece9242294 to your computer and use it in GitHub Desktop.
Filter WordPress posts by custom taxonomy term with AJAX
<?php
function assets() {
wp_enqueue_script('tuts/js', 'scripts/tuts.js', ['jquery'], null, true);
wp_localize_script( 'tuts/js', 'bobz', array(
'nonce' => wp_create_nonce( 'bobz' ),
'ajax_url' => admin_url( 'admin-ajax.php' )
));
}
add_action('wp_enqueue_scripts', 'assets', 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment