Beta Versioning of Plugins

If your current plugin version is 1.2.5, and you have a beta version for the next version, it should be called 1.2.6-beta. Your user can install it, and when the real 1.2.6 version is released on the repository, WordPress will notify the user on the Plugins page and let him update. WordPress uses a PHP … Read more

Admin menu as submenu from another plugin

Trying to simulate the issue, it happened the same (wp-admin/submenu_slug), and the solution is to add a priority value in the hook admin_menu. Here, I’m adding a sub menu to the plugin BackWPup. Note the priority 11: add_action(‘admin_menu’, ‘third_party_submenu_wpse_91377’, 11 ); function third_party_submenu_wpse_91377() { add_submenu_page( ‘backwpup’, // Third party plugin Slug ‘My plugin’, ‘My plugin’, … Read more

How to add custom content template part for a custom post type on main query using a plugin

Background Unfortunately get_template_part() function doesn’t have any suitable filter to achieve what you want. It’s possible to use the get_template_part_{$slug} action hook to inject template parts, however, without any change to your theme or a child theme, the original template part will be added anyway. So this way you’ll not be able to replace existing … Read more

Preserve custom URL parameter on more pages

You will need to intercept the links generated by WordPress and append the query var onto the relevant URLs. You can do this quite easily with a filter on category URLs with something like… function add_my_query_var( $link ) { $link = add_query_arg( ‘sort’, ‘most_voted’, $link ); return $link; } add_filter(‘category_link’,’add_my_query_var’); I also spotted this handy … Read more

How to force WordPress to temporarily switch locale (using qTranslate)? [closed]

And I got it. What was missing was re-loading the text domain for WooCommerce, that was loaded with the current locale at initialization: // set the current locale and send email with it active unload_textdomain(‘woocommerce’); setlocale(LC_ALL, $new_locale); global $q_config, $locale, $woocommerce; $locale = $new_locale; $q_config[‘language’] = substr($new_locale, 0, 2); $woocommerce->load_plugin_textdomain(); global $wc_cle_wc_email; $wc_cle_wc_email->customer_completed_order($order_id); // set … Read more

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