Plugin child folder?

You don’t, for the same reason you don’t modify WordPress Core, you extend it or use hooks and filters to modify its behaviour. So when extending or changing plugins you have 2 options: Forking You’ve been creating forks of a plugin so far, but it’s important to change the name when this happens so your … Read more

dequeue not work

Scripts should be enqueued on wp_enqueue_scripts action hook, which runs after init action. So dequeuing on init won’t work because sripts are not enqueued yet. Before enqueued scripts are printed, wp_print_scripts action is triggered so you can dequeue or unregister scripts safely at this moment: add_action( ‘wp_print_scripts’, ‘drw_timelinr_dequeue’ ); function drw_timelinr_dequeue () { wp_dequeue_script(‘jquery.timelinr’); } … Read more

do_action and hook methods

Your analogy here is partially correct, but incomplete: I understand that when do_action is called wp looks for all registered listeners and invokes them according set priority. You need to consider what happens when you call add_action. WordPress never searches for the add_action statements, it has those in a list. When you call add_action, it … Read more

Get product attribute for Simple product in WooCommerce

Building on Loic’s answer for an attribute of pa_manufacturer: if ( get_post_type( $post ) === ‘product’ && ! is_a($product, ‘WC_Product’) ) { $product = wc_get_product( get_the_id() ); // Get the WC_Product Object } $product_attributes = $product->get_attributes(); // Get the product attributes // Output $manufacturer_id = $product_attributes[‘pa_manufacturer’][‘options’][‘0’]; // returns the ID of the term $manufacturer_name = … Read more

How to unregister a widget from a child theme

Assuming the Parent Theme’s Widget is registered at the widgets_init hook, all you need to do is wrap your unregister_widget() call inside of a function, hook that function into widgets_init, and give your hook a higher priority number than the Parent Theme’s widgets_init-hooked function. Assuming the Parent Theme hooks into widgets_init without giving a priority … Read more

debugging register_activation_hook()

I feel a bit dense for not noticing this sooner, but I finally realized that my plugins directory on my computer is a symbolic link to another location as pointed out by Kunal Bhalla in symlinks with WP plugins. Since __FILE__ resolves symbolic links register_activation_hook() is attempting to load a file outside of the WordPress … Read more

How does wordpress distinguish a plugin’s main php file from other php files? [duplicate]

WordPress has no convention for naming of main file. It scans whole plugins directory (see get_plugins() ) and looks for plugin header (with get_plugin_data())in every PHP file on appropriate directory levels. This is only performed when you actually need full list of plugins. Thing like active plugins are calculated and stored separately so that for … Read more