Get current user, change users post status to published

The database holds several rows for each attribute of a post. All except on row should have status inherit. So I just hope the post_id is correct. Anyway, yes you are correct to assume that it is similar: $query = array( ‘ID’ => $post_id, ‘post_status’ => ‘publish’, ); wp_update_post( $query, true ); Oh and add_action(‘publish_post’… … Read more

How to create REST Based JSON API(how to modify the code below)?

try this: if (isset($_GET[‘api’])) { if ($_GET[‘api’] == ‘json’ && isset($_GET[‘id’])) { $args = array( ‘p’ => $_GET[‘id’], ‘post_type’ => ‘any’// ID of a page, post, or custom type ); $query = new WP_Query($args); // $query is the WP_Query Object $post = $query->post; // $post contains the post object header(“content-type: application/json”); echo json_encode($post); } exit(); … Read more

Display post on main page with thumbnail

What you need is a featured post plugin, you can either display that POST in the widget area or below the SEPARATOR line by using a template function. You can find many plugins to do this job at WordPress Plugin Repository. Link Here are 2 plugins Display Features News on Front Page Featured Post Content … Read more

Add Categories To Custom Post

Assuming that your post type is registered as albums, you can add a custom taxonomy to the post type as follows: add_action( ‘init’, ‘create_album_taxonomy’ ); function create_album_taxonomy() { register_taxonomy( ‘albumtype’, ‘albums’, // content type here array( ‘label’ => __( ‘Album Type’ ), ‘rewrite’ => array( ‘slug’ => ‘albumtype’ ), ‘hierarchical’ => true, ) ); } … Read more