wp_set_object_terms and arrays

I doubt it would justify the effort of writing custom SQL queries for only 2500 posts. Within the wp_set_object_terms( $object_id, … ) function we have: $object_id = (int) $object_id; so it’s correct that it only takes a single post id as input. So you would need to loop over your $post_ids array but it might … Read more

How to paginate a list of custom taxonomy terms?

Your shortcode is extremely expensive to run. get_term_link() is not user friendly when you feed it with term ID’s as it results in a db query to query the term object. If you feed the term object to get_term_link(), it is happy and do not need to do any work to get the term object. … Read more

Integrating WordPress to my website, while keeping my own authentication system

WordPress’s authentication system is made up of pluggable functions, which means that you can write a plugin that has a function named, say, wp_authenticate(), and your site will use your wp_authenticate() function instead of the native WordPress one. Your comment about is_user_logged_in() (on your original post) is obviated by the fact that is_user_logged_in() calls the … Read more

How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table

Look at this code public function column_default( $item, $column_name ) { switch ( $column_name ) { case ‘address’: case ‘city’: return $item[ $column_name ]; default: return print_r( $item, true ); //Show the whole array for…. } } Since you are only trying to render user_id , browser and ip_address and those are not available in … Read more

How to run multiple Async HTTP requests in WordPress?

The (built-in) Requests class lets you call multiple requests simultaneously: Requests::request_multiple. <?php $requests = Requests::request_multiple([ [ ‘url’ => ‘https://www.mocky.io/v2/5acb821f2f00005300411631’, ‘type’ => ‘GET’, ‘headers’ => [ ‘Accept’ => ‘application/json’ ], ], [ ‘url’ => ‘https://www.mocky.io/v2/5acb821f2f00005300411631’, ‘type’ => ‘POST’, ‘headers’ => [ ‘Accept’ => ‘application/json’ ], ‘data’ => json_encode([ ‘text’ => ‘My POST Data’ ]) ], [ … Read more

Separate WordPress themes for each category page

I think what would work best for your case is making use of the WordPress template hierarchy. You can actually just create a custom template file in your theme folder named category-{slug}.php to get a custom look for that category. Example: If your category was ‘Dogs’ and the slug you set for it was ‘dog’, … Read more

remove tags from posts in php

Below is code that works: function untag_posts($post_ids, $tags) { global $wpdb; if(! is_array($post_ids) ) { $post_ids = array($post_ids); } $in_post_ids = implode(“‘,'”, $post_ids); if(! is_array($tags) ) { $tags = array($tags); } $in_tag_names = “‘” . implode(“‘,'”, $tags) . “‘”; $query = “SELECT tt.term_taxonomy_id ” . ” from $wpdb->terms as t ” . ” JOIN $wpdb->term_taxonomy … Read more