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

Can I use the wp media uploader for my own plugin?

You can use wp_enqueue_media() in your admin_enqueue_scripts hook. In a javascript file hook it into a button and use insert event to capture the selected image’s details $(‘.media-button’).click(function() { var media_uploader = wp.media({ frame: “post”, text : “Add image”, state: “insert”, multiple: false }); media_uploader.on(“insert”, function(){ var json = media_uploader.state().get(“selection”).first().toJSON(); var image_name = json.filename; var … Read more

Add Custom User Capabilities Before or After the Custom User Role has Been Added?

There’s a reason why add_role() has the $capabilities as 3rd parameter. First some insights on what happens, when you use the function. It calls WP_Roles->add_role() – the class method The method then does a check if the role already exists. If yes, it aborts. The next step is, that it adds the role to WP_Roles->roles[] … Read more

Any examples of adding custom fields to the category editor?

No. You have to use wp_options, because you can’t create new fields in the wp_term_taxonomy table (If you do, in the next WP update you’ll loose them). So: // the option name define(‘MY_CATEGORY_FIELDS’, ‘my_category_fields_option’); // your fields (the form) add_filter(‘edit_category_form’, ‘my_category_fields’); function my_category_fields($tag) { $tag_extra_fields = get_option(MY_CATEGORY_FIELDS); ?> <table class=”form-table”> <tr class=”form-field”> <th scope=”row” valign=”top”><label … Read more

How to provide translations for a WordPress TinyMCE plugin?

Use the filter ‘mce_external_languages’. From wp-includes/class-wp-editor.php: The following filter loads external language files for TinyMCE plugins. It takes an associative array ‘plugin_name’ => ‘path’, where path is the include path to the file. The language file should follow the same format as /tinymce/langs/wp-langs.php and should define a variable $strings that holds all translated strings. When … Read more

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