Custom “Uploads” Dir: “Edit Image” in Media Library broken
The uploads dir has its own define in wp-config: define( ‘UPLOADS’, WP_CONTENT_URL.’/customuploads’ );
The uploads dir has its own define in wp-config: define( ‘UPLOADS’, WP_CONTENT_URL.’/customuploads’ );
This is Trac ticket 51223: commonL10n and other JS globals removed without backwards compatibility In WordPress 5.5, the localized translations under commonL10n were replaced by wp.i18n.__ without deprecation notice or backwards compatibility. Plugins using commonL10n now have JavaScript errors introduced by updating WordPress which can break site functionality. It was fixed in 5.5.1 by adding … Read more
http://codex.wordpress.org/Javascript_Reference/wp It’s a work in progress. Contribute if you can!
Do not put the Customizer ready event handler inside of the jQuery event handler. The Customizer ready will trigger at jQuery ready, so you are adding the event handler too late. Just do: wp.customize.bind(‘ready’, function(){ console.log(‘ready’); }); Your JS needs to be enqueued with customize-controls script as its dependency. Enqueue at the customize_controls_enqueue_scripts action.
You should be forewarned that not all plugins/themes use enqueue. When I first started dealing with all the JavaScripts and CSS files outputed I just hooked into the enqueued files. This resulted in me only getting 2 out of 10 JavaScript files and 1 out of 3 CSS files. Here is some quick PoCs. Neither … Read more
Based on the code provided it looks like you are misunderstanding how wp_localize_script works. The signature of the function looks like this: wp_localize_script( $handle, $name, $data ); Where $handle is the name of a JavaScript file you have registered or enqueued before calling wp_localize_script. Take a look at the example in the codex (I’ve added … Read more
To extend on @gmazzap suggestion on not using globals when you can use wp_scripts(), there is a shortcut for wp_scripts() for adding conditional comments called wp_script_add_data and likewise wp_style_add_data for conditional styles. So the correct way to use conditionals as of WordPress 4.2 is like this: /** * IE enqueue HTML5shiv with conditionals * @link … Read more
There is a dequeue method available … I’m just not sure why it isn’t wrapped in a wp_dequeue_script() method. (I might create a ticket for this issue, actually) But yes, using wp_deregister_script will accomplish what you’re trying to do. Just remember, if you ever do want to use WP’s built-in jQuery later you’ll need to … Read more
wp_enqueue_style and wp_enqueue_script accepts many parameters and it’s very important to use them in correct order otherwise these functions will fail. Here are complete set of parameters for each function. wp_enqueue_style( $handle, $src, $deps, $ver, $media ); wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); In your wp_enqueue_style you define $handle, $src correctly but $deps to … Read more
I don’t think using React.js without Node.js (or at least V8 or rhino etc) counts as isomorphic, as isomorphic means that you are building JavaScript to run in the browser AND on the server. Specifically, using WordPress certainly means you aren’t doing isomorphic javascript (its PHP software). What you could do is use WordPress as … Read more