Custom post type and custom taxonomy 404 on page 2

So after many trials and errors, I found I had to create a specific rewrite rule to go into my functions.php, one that handles post type ‘videos‘ and the category (taxonomy) ‘videos_category‘: add_filter(‘init’, function() { add_rewrite_rule( ‘^videos/([^/]*)/([^/]*)/(\d*)?’, ‘index.php?videos_category=$matches[1]&p=$matches[2]&paged=$matches[3]’, ‘top’ ); }); I also found this plugin to be really helpful for viewing my rewrite rules: … Read more

Problem with custom loop and wp_list_pluck [closed]

Problem solved! You need to change this part of code before 3rd query… it will merge you previous queries and exclude posts from them: $first_grid_posts_ids = wp_list_pluck( $first_grid_query->posts, ‘ID’ ); $second_grid_posts_ids = wp_list_pluck( $second_grid_query->posts, ‘ID’ ); $allTheIDs = array_merge( $first_grid_posts_ids , $second_grid_posts_ids ); $third_grid_query = new WP_Query( array( ‘posts_per_page’=>4, ‘post_type’ => ‘post’, ‘cat’ => get_query_var(‘cat’), … Read more

extract serialized array to use for wp-query

You need to unserialize() if its serialized string. In your case from what I understand you store the array in the user_meta so its serialize it when you store it. but it will unserialize it when you use the get_user_meta so you dont need to unserialize() Your code seems fine. $author_in = get_user_meta($current_user->ID, ‘following_users’, true); … Read more

How to remove custom style from source?

This issue has been around at least since 2010. Though you can override the style in other ways, the easiest way (other than avoiding use of the Recent Comments Widget) just to remove it is to add the following code to your functions.php file: add_filter( ‘show_recent_comments_widget_style’, ‘__return_false’, 99 ); see: https://core.trac.wordpress.org/ticket/11928#comment:11 Tested and works.

Get the users that my following users are following

You can use the implode function to concatenate array elements: $get_the_following_users = get_user_meta($current_user->ID, ‘following_users’, true); $meta_qssuery = ”; //initialise to an empty string foreach ( $get_the_following_users as $following_user ) { $following_user = get_user_meta($following_user, ‘following_users’, true); if(!empty($following_user)) { //check if any data was returned $meta_qssuery .= implode(‘, ‘, $following_user).’, ‘; } } echo $meta_qssuery; This will … Read more

Change header on pages displaying taxonomy items

You need to change the code that currently displays that header, so that it doesn’t display the default title when it’s on this taxonomy. You can detect if you are on a taxonomy page with the is_tax() function, and then you could do something like this: $term_array = get_term_by( ‘slug’, get_query_var( ‘term’ ), ‘materia’ ); … Read more