How to iterate on a list?

To do this without coding will be difficult. Contact Form 7 is meant to send out emails after form submission, not much more. You need a callback function that you can use to implement your coupon logic. One possible solution: Install the Redirect Addon for Contact Form 7 and configure it to redirect to a … Read more

How to allow editors to only edit certain categories?

You can hook into the pre_post_update action hook, and check both post’s category and editor. Here’s a quick example: // Hook to save_post to do some checks add_action( ‘pre_post_update’,’wpse315124_save_post_check’ ); function wpse315124_save_post_check( $post_id, $post_data ){ // Check user’s role and post’s category if( has_category ( ‘some-category’, $post_id ) && current_user_can( ‘editor’ ) ) { // … Read more

WordPress showing fatal error on wp_set_object_terms line

wp_insert_term returns an array on success or a WP_Error in case of problems. You should catch the error and look for the reason why it fails. One problem could be, how you create the slug, because it could lead to an error during the creation of the term. Just use $slug = sanitize_title( $T_product_type ) … Read more

Plugin Options Page and Subpage

If you want to use multiple options pages for plugin, ensure that your sanitize function gets the additional missing options from the database example public function sanitize($input): array { /** My Plugin Setting Options */ $option = get_option(‘my_plugin_settings’); /** Do this for all the settings keys in your options array */ if ($input[‘setting_key’]) { $output[‘setting_key’] … Read more