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 | |
// I wanted to be able to use Select2's tagging feature to add new terms to posts in wordpress. I slighlty modified the code from Misha Rudrastyh's excelent tutorial(link below). Comments are closed on that post so I figured I'd post this gist for anyone else wanting to do this. Here's the portion of code I modified: | |
// @https://rudrastyh.com/wordpress/select2-for-metaboxes-with-ajax.html | |
// Note: if you'd like to limit selection you can remove "multiple="multiple"" from the select box, | |
//or you can use Select2's "maximumSelectionLength" feature to limit to any number. | |
function rudr_display_select2_metabox( $post_object ) { | |
// do not forget about WP Nonces for security purposes |