wp_register_script multiple identifiers?

To have the JavaScript Libraries not to load since you already created a bundle of them, do the following: Asumming the following, usual enqueue: function the_js() { wp_enqueue_script(‘bundle_js’, get_template_directory_uri() . ‘/js/bundle.js’, array(), false, false); } add_action(‘wp_enqueue_scripts’, ‘the_js’); and lets say you have in your bundle the following libraries (listing the handles): jquery backbone colorpicker bootstrap_js … Read more

Setting up an API “listening” page

I would use the Rewrite API and the template_redirect action to respond to API requests. As an example, if I wanted to respond to requests directed to the url: example.com/example-path/ with logic in my theme or plugin’s endpoint.php file I would create a rewrite rule and template redirect hook like so: add_action( ‘init’, ‘example_rewrite_rules’ ); … Read more

Odd Script File Trying to be Loaded

In Network Admin > Settings > Domain Mapping > Domain Options, uncheck Remote Login. That should also remove it. In my case, the “script” just retrieves the home page (html), causing a script error and a lot of wasted resources on every page view. Similar complaints in Does Domain Mapping plugin insert javascript on headers?.

Editing Source Code in WordPress

You don’t want to edit core WordPress code. You don’t need to edit core WordPress code to do what you need to implement. First, you need to study the WordPress templating (i.e. Theme) functionality. Then, you need to study Plugins and the WordPress Hooks API, including its Action Hooks and its Filter Hooks. To do … Read more

Is it possible to change the attributes of a registered style or script before it fires?

Modify a registered style’s path I wanted to tweak the path to one of the WordPress admin stylesheets so i could keep requests down, and because it makes little sense to include two stylesheets, when the one i’m calling redefines all the styling in the stylesheet enqueued by WordPress. The idea is basically to re-point … Read more

How to prevent wordpress from loading old versions of jquery in wp_head();?

add_action(‘wp_enqueue_scripts’, ‘no_more_jquery’); function no_more_jquery(){ wp_deregister_script(‘jquery’); } That will deregister jquery. But why wouldn’t you want jQuery at all? If you mean to simply use your own, you should do it in that function, like this: add_action(‘wp_enqueue_scripts’, ‘no_more_jquery’); function no_more_jquery(){ wp_deregister_script(‘jquery’); wp_register_script(‘jquery’, “http” . ($_SERVER[‘SERVER_PORT’] == 443 ? “s” : “”) . “://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”, false, null); wp_enqueue_script(‘jquery’); … Read more

Get list of scripts / styles and show file which enqueued them

This is not possible the way you think. It would maybe be possible if you use Reflections or debug_backtrace(), but there’s no reliable way to do this. WordPress does not keep a stack or queue where it tracks file names. The only thing I could imagine is just hooking into the action and inside wp_enqueue_scripts(): … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)