wp enqueue script using scripts from cdn with a safety callback

The accepted answer is completely wrong. I suspect a gross misunderstanding of the OP’S question, since anyone with even a little experience with programming will never recommend something like “cache your own copy of the script, and perform get_url calls every 20 minutes”. @Paul G. says there is no point in loading from the CDN … Read more

current_shortcode() – detect currently used shortcode

This is untested, but the callback function is provided with an array of arguments, $args which give (if any) the paramters provided with the shortocode. The zeroth entry sometimes contains the name of the shortcode used (e.g. public_email). By sometimes I mean… The zeroeth entry of the attributes array ($atts[0]) will contain the string that … Read more

How to pass arguments from add_settings_field() to the callback function?

Look at the declaration for the function: function add_settings_field( $id, $title, $callback, $page, $section = ‘default’, $args = array() ) { } The last parameter takes your arguments and passes them to the callback function. Example from my plugin Public Contact Data foreach ($this->fields as $type => $desc) { $handle = $this->option_name . “_$type”; $args … Read more