Issue with contact form 7

Invalid mailbox syntax is used Error You can find Invalid mailbox syntax is used error under the To, From, Subject or Additional Headers fields, that are located in the Mail Contact Form tab. solve “Your contact form has a configuration issue” error You have to solve this error. Otherwise, your email might not reach the … Read more

WooCommerce Custom Pagination

Hope you are doing good. You can use the below sample code: Updated: I have updated my Gist link to added code of template. Create a template with name template-product.php <?php /** * @author Baikare Sandeep * * Template Name: Product */ get_header(); ?> <?php $args = array( ‘posts_per_page’=> 12, ‘post_type’ => ‘product’, ‘post_status’ => … Read more

Delete posts with word count less than x number of words

function delete_posts() { $lastposts = get_posts(array(‘numberposts’ => -1)); if ( $lastposts ) { foreach ( $lastposts as $post ) : setup_postdata( $post ); ?> <?php $content = get_the_content(); if (str_word_count($content) < 100) { wp_trash_post($post->ID); } ?> <?php endforeach; wp_reset_postdata(); }}add_action( ‘init’, ‘delete_posts’ );

Cross origin ajax request always returns 0 when calling get_current_user_id();

Don’t write your own bootstrapper, use Ajax hooks via wp-admin/admin-ajax.php Documentation: https://codex.wordpress.org/AJAX_in_Plugins Then you can be sure WordPress has included all the functions you need. Update: I missed the bit about posting from local machine to remote server. If your JavaScript is running on another domain, it won’t be sending back your web server’s login … Read more

Adding Gravity Form With if(is_page) Is Not Working

if you got following in your functions.php function add_split_test_forms() { if (is_page(‘Homepage’)): gravity_form(19, false, false, false, ”, false); endif; } you will at least need to run this function once: add a line add_split_test_forms() in your functions.php. if your condition if (is_page(‘Homepage’)): is correct. (I prefer if ( is_front_page()): should also work.) Then your form … Read more

static array on functions.php

This is a good use case for the Object Cache: WP_Object_Cache is WordPress’ class for caching data which may be computationally expensive to regenerate, such as the result of complex database queries. You can store things in the cache with wp_cache_set() and retrieve them with wp_cache_get(). You just need to give it a key and … Read more

custom css in admin panel by user id

Use below code into functions.php file. Make sure you are using it right way use admin_enqueue_scripts add_action(‘admin_enqueue_scripts’, ‘FUNCTION_NAME’);function FUNCTION_NAME() { global $current_user; $user_id = get_current_user_id(); if(is_admin() && $user_id == ‘2’){ wp_enqueue_style( ‘admin_css’, get_template_directory_uri() . ‘/admin-style.css’, false, ‘1.0.0’ ); }}