WooCommerce “Save Changes” button appears inside custom settings

Ok, the fix is quite easy, although not obvious at all. All we need to do is just add array( ‘type’ => ‘sectionend’, ‘id’ => ‘test-options’ ), to the end of the settings group. So the final function should look like this: add_action( ‘woocommerce_settings_start’, ‘wpse8170_register_settings’ ); function wpse8170_register_settings() { global $woocommerce_settings; $woocommerce_settings[‘test’] = array( array( … Read more

wp_mail() is not working on server

Since PHP Mailer is working fine do you have the same credentials setup for wp_mail? If you’re using an authenticated SMTP for PHP Mailer then you’ll possibly need a plugin to get the authentication into wp_mail. There are a few different ones that all work but one is https://wordpress.org/plugins/wp-mail-smtp/ for example.

Woocommerce custom shared taxonomy

Found solution for this problem. It turned out that woocommerce affects post_type query variable in pre_get_posts filter without checking that another post_type has been requested. It’s done in WC_Query.product_query method: if ( ! $q->is_tax( ‘product_cat’ ) && ! $q->is_tax( ‘product_tag’ ) ) $q->set( ‘post_type’, ‘product’ ); Fix for this problem is simple. You just need … Read more

Plugin “Meta Box”: Implementing meta boxes in custom post type

In this instance you would need to find the hook into the specific metabox and add your custom post type to its pages array, for example: $meta_boxes[‘test_metabox’] = array( ‘id’ => ‘test_metabox’, ‘title’ => ‘Test Metabox’, ‘pages’ => array(‘post’,’page’,’artists’), //list custom post types here! ‘context’ => ‘normal’, ‘priority’ => ‘high’, The Meta Box plugin essentially … Read more

List users except current user using wp_dropdown_user? [closed]

Your problem is here: ‘exclude’ => ‘$user_id,1′, This will generate the string ‘$user_id,1’, it won’t insert the user ID into your string. The reason for this is the difference between ‘$hello’ and “$hello” E.g. $hello = 5; echo ‘$hello’; // prints out $hello echo “$hello”; // prints out 5 So using double rather than single … Read more

Dashboard Disappears after Upgrade

That is a seriously wonky plugin, my friend. Prologue Before we actually start, trash this conditional – it does absolutely nothing: if($_REQUEST[‘s’] != ”) { } But really, more than likely, the original plugin developer had intended this conditional to actually do something by bailing out of the function if $_REQUEST[‘s’] is not set (seeings … Read more

add function to saving change on Options Pages

To execute a task after a option has been updated, you can use updated_option action hook: add_action( ‘updated_option’, ‘updated_option_callback’, 10, 3 ); function updated_option_callback( $option, $old_value, $value ) { //Do something } Also, you can use update_option_{option-name} specifically for each option. For example: add_action( ‘update_option_new_option_name’, ‘update_new_option_name_callback’, 10, 2 ); function update_new_option_name_callback( $old_value, $value ) { … Read more

How to show category images (from plugin) on a regular page (page-example.php)?

Untested, but something like this should work. $siteurl = home_url(“https://wordpress.stackexchange.com/”); $tax = ‘region’; // slug of taxonomy $terms = get_terms($tax); foreach ($terms as $term) { $id = $term->term_id; $slug = $term->slug; $description = $term->description; $image_url = z_taxonomy_image_url( $id, NULL, TRUE ); $link = “<a href=”https://wordpress.stackexchange.com/questions/176555/$siteurl?$tax=$slug” ><h1> $term->name </h1></a>”; echo $link; echo ‘<p>’ . $description . … Read more

WordPress Plugin Boilerplate – add_action hook in static “activate” function

The problem is the initialization in WordPress via register_activation_hook( __FILE__, ‘activate_IWCollege_Courses’ ); The function was fired on the Activation of a plugin, not more. You must switch to the hook init. For Custom Post types, the init hook is recommended in the codex. Custom post types must be registered during every WordPress initialization. But the … Read more