Skip to content

Instantly share code, notes, and snippets.

@enru
Created April 29, 2013 08:56
Show Gist options
  • Select an option

  • Save enru/5480485 to your computer and use it in GitHub Desktop.

Select an option

Save enru/5480485 to your computer and use it in GitHub Desktop.
spits out page/post slug on WordPress autosave/edit
<?php
/*
Plugin Name: Ajaxtest
Plugin URI: http://enru.co.uk/
Description: spits out page/post slug on autosave/edit
Version: 0.1
Author: Neill Russell (@enru)
Author URI: http://enru.co.uk/
*/
add_action('init', function() {
wp_enqueue_script(
'my-custom-script' // handle
,plugin_dir_url(__FILE__) . '/custom_script.js' // src
,array( 'jquery' ) // deps
,false // version
,true // in footer
);
});
jQuery(function($) {
makeSlugeditClickable = (function() {
original_makeSlugeditClickable = makeSlugeditClickable;
return function() {
// this is your slug:
var new_slug = $('#editable-post-name-full').html();
// do something with it
console.log(new_slug);
return original_makeSlugeditClickable()
}
})();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment