Custom post type ‘articles’ ignores posts_per_page, reserved post_type?

I deleted the CPT UI plugin and declared the post type functionally… this solved the problem. function custom_post_type_articles() { $labels = array( ‘name’ => _x( ‘Articles’, ‘Post Type General Name’, ‘cyprusprofile’ ), ‘singular_name’ => _x( ‘Article’, ‘Post Type Singular Name’, ‘cyprusprofile’ ), ‘menu_name’ => __( ‘Articles’, ‘cyprusprofile’ ), ‘parent_item_colon’ => __( ‘Parent Article’, ‘cyprusprofile’ ), … Read more

How to extract specific post

As noted in the documentation meta_value, when not used inside a meta query, needs to be a string. Normally if you want to query based on multiple meta values you need to add a meta_query argument. But also as noted in the documentation regarding value: It can be an array only when compare is ‘IN’, … Read more

WP_Query() order by post content lenght?

As Tom has said in his comment, there is no option for WP_Query for ordering posts by their word count/length. If you wanted to do this then you would have to firstly store the word count or length of each post as post meta. Once this was stored, you could then use WP_Query like so: … Read more

Dynamic User Id

You can use get_the_author_meta() which returns the requested data of the author of the current post. If you’re on the author archive page (e.g. author.php) that will be the ID of the user whose profile you are on. get_the_author_meta( ‘ID’ );

Order by empty custom field

There are two solutions for that: 1. Make sure that all posts have that field set. You can do this easily – just use save_post hook and set it to default value. (You should also add default values for already existing posts that don’t have that field set.) 2. Use a little bit modified query … Read more