Disable `create_post` for built-in post type

There is no built-in capability of create_post. Update: There is a capability create_posts but it’s not well publicised and also has issues surrounding it which I’m afraid I don’t have time to look into at the moment. There are already answers that might help: https://stackoverflow.com/a/3248103 https://wordpress.stackexchange.com/a/178059/94267 Original answer: There is publish_posts. You need to turn … Read more

Only get post_id [duplicate]

Quick shot: $countries = get_pages(array( “hierarchical” => 0, “sort_column” => “menu_order”, “sort_order” => “desc”, “meta_key” => “page_type”, “meta_value” => 2, )); $page_ids = array(); foreach ( $countries as $country ) { $page_ids[] = $country->ID; }

Compare date of user’s last posts

According to the codex, you’re manipulating get_most_recent_post_of_user()‘s returned value the wrong way. get_most_recent_post_of_user() directly returns the post_date_gmt among blog_id, post_id, and post_gmt_ts. Anyway, if you want to get the 2 last posts of a specific author, use WP_Query instead, which should by default get last posts in the order you need. $author_id = $author_id; $args … Read more