Use Media Uploader in Plugin

Try using this code: define(“ME_URL”, rtrim(WP_PLUGIN_URL,”https://wordpress.stackexchange.com/”) . “https://wordpress.stackexchange.com/” . basename(dirname(__FILE__))); define(“ME_DIR”, rtrim(dirname(__FILE__), “https://wordpress.stackexchange.com/”)); function my_admin_scripts() { wp_enqueue_script(‘media-upload’); wp_enqueue_script(‘thickbox’); } function my_admin_styles() { wp_enqueue_style(‘thickbox’); } add_action(‘admin_print_scripts’, ‘my_admin_scripts’); add_action(‘admin_print_styles’, ‘my_admin_styles’); <td> <img src=”<?php echo esc_attr( get_the_author_meta( ‘profileimage’, $user->ID ) ); ?>” id=”ppimage”> <input type=”text” name=”profileimage” id=”profileimagetxt” value=”<?php echo esc_attr( get_the_author_meta( ‘profileimage’, $user->ID ) ); ?>” class=”regular-text” /><br … Read more

Remote plugin activation hook

Use activate_plugin() instead: activate_plugin( $plugin, $redirect=””, $network_wide = false, $silent = false ) You need just the first parameter, the same value as in the option. This function will call the necessary actions: if ( ! $silent ) { do_action( ‘activate_plugin’, $plugin, $network_wide ); do_action( ‘activate_’ . $plugin, $network_wide ); } Note: depending on where … Read more

Get the current taxonomy product category title in woocommerce

You could use get_the_term_list echo get_the_term_list( $post->ID, ‘product_cat’, ‘<div style=”direction:rtl;”>’, ‘</div>’, ” ); The system of displaying 1 category title on a single product page fails if you start adding the item to multiple categories. I went crazy once on a project where a client was adding portfolio items to two categories and yet somehow … Read more

Built in admin ajax hooks?

WordPress core is something where you cannot create your own hooks. Hooks in WordPress are created with these apply_filters apply_filters_ref_array apply_filters_deprecated do_action do_action_ref_array do_action_deprecated The only thing you can do is to register your function to certain WordPress core hook. But where are these hooks? You may expect these hooks in a function called activate_plugin. … Read more

Load WooCommerce templates from my plugin folder first

I think you can use template redirect action. I don’t test it but it should work: function my_template_redirect(){ //pages you want to make true, ex. is_shop() if(is_shop()) { $plugin_dir = WP_PLUGIN_DIR.”https://wordpress.stackexchange.com/”.str_replace( basename( __FILE__), “”, plugin_basename(__FILE__) ); load_template($plugin_dir . ‘your-template.php’); } } add_action(‘template_redirect’,’my_template_redirect’);

Can’t change a label in woocommerce with the normal filter

You have to use the woocommerce_default_address_fields hook: add_filter( ‘woocommerce_default_address_fields’ , ‘wpse_120741_wc_def_state_label’ ); function wpse_120741_wc_def_state_label( $address_fields ) { $address_fields[‘state’][‘label’] = ‘County’; return $address_fields; } This (and more) is described at the woocommerce docs: Customizing checkout fields using actions and filters, so read your stuff next time thoroughly… 😉 Edit: Above code isn’t working for all cases, … Read more

How to load plugin before the wordpress jquery?

1.0.0? Really?! Anyway you could try the print_scripts_array filter: // Hack of wp_prototype_before_jquery() in “wp-includes/script-loader.php” function wpse157295_print_scripts_array( $js_array ) { if ( false === $jquery = array_search( ‘jquery-core’, $js_array, true ) ) // Now ‘jquery-core’, not ‘jquery’ return $js_array; $keys = array( ‘jquery.min’, ‘highcharts’, ‘exporting’ ); foreach ( $keys as $key ) { if ( … Read more