Set “editor” role to existing user

Usermeta key that stores the user’s role has a prefix in the name, the one set in the wp-config.php file. So meta_key will have the form {prefix}_capabilities and your query should look like global $wpdb; $wpdb->query( $wpdb->prepare( “UPDATE {$wpdb->usermeta} SET meta_value=”a:1:{s:6:\”editor\”;b:1;}” WHERE user_id = %d AND meta_key = ‘{$wpdb->prefix}capabilities'”, $user_id ) ); You do not … Read more

Query post by Category and custom file (ACF)

You make a few mistakes in your code. To query posts by category you can use category_name [ref] or tax_query [ref] in query parameters. // category_name / cat / category__and ‘category_name’ => ‘event’, ‘tax_query’ => [ [ ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘event’, ] ], ACF checkbox are stored in custom field, … Read more

WordPress Carousel with recive posts (Bootstrap)

Following is the reformatted code for your slider code. Instead of two custom queries, only one is used for rendering items. Also note that, you should always avoid query_posts, use WP_Query instead. $the_query->current_post is used for implementation of active class. Please check out the following example and customize it as per your requirement. <div id=”myCarousel” … Read more

Wp-query and column blocks

The new block editor gives lots of possibilities to arrange information inside one post. What you are asking for is the arrangement of multiple posts. That’s not a task for the block editor but for the theme. So, for your question: it depends on the theme whether this is possible. If you are designing your … Read more