Order by Post Title in WP Query not working
Order by Post Title in WP Query not working
Order by Post Title in WP Query not working
Child Comments not showing in `wp_comment_query`
I’m looking real hard at the code around both hooks, and they run one right after the other, with the same arguments, and I just can’t see any meaningful difference. Theoretically only parse_query would run, and not pre_get_posts, if WP_Query::parse_query() were to be run directly on its own, but WordPress itself never does that. Maybe … Read more
PHP strtotime() takes some weird string values that we can use in combination with the WP_Query date_query ‘before’ keyword. For example, we can get X posts before 1 year before tomorrow: $tomorrow_a_year_ago = wp_date( ‘Y-m-d’, strtotime( ‘-1 year +1 day’ ) ); $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 5, ‘post_status’ => ‘publish’, ‘orderby’ … Read more
I was calling the category id instead of the category name. Here’s the code that by default tries using tags to bring in relevant posts, and if there are no posts by tags it’ll bring in posts using the same category. This code work in the single.php using the Ajax Load More wordpress plugin. // … Read more
The issue you’re experiencing is due to how WordPress handles queries with multiple post types. When you specify multiple post types in the post_type parameter of a WP_Query, WordPress will only return posts that match all of the specified post types. In your case, when you include both ‘post’ and ‘podcast’ in the post_type array, … Read more
How to add an extra parameter to searches on the admin listing screen for my custom post type
Problem making a WPQuery with ACF boolean
order meta_value_num not working
// Add Username Field to Registration Form add_action( ‘woocommerce_register_form_start’, ‘custom_woocommerce_register_username’ ); function custom_woocommerce_register_username() { ?> <p class=”form-row form-row-wide”> <label for=”reg_username”><?php _e( ‘Username’, ‘woocommerce’ ); ?> <span class=”required”>*</span></label> <input type=”text” class=”input-text” name=”username” id=”reg_username” value=”<?php echo ( ! empty( $_POST[‘username’] ) ) ? esc_attr( wp_unslash( $_POST[‘username’] ) ) : ”; ?>” /> </p> <?php } // Validate … Read more