I'm developing a ticketing system which already has the custom post type for the tickets with a "status" taxonomy. I have the tickets displayed in a table on the front-end and the status column has the status values in a dropdown with the current status selected by default. How can I change the status taxonomy on the back-end based on the selection of the dropdown on the front-end?

1 Answer 1


That would be achieved using the wp_set_post_terms function.


You could run an ajax request on the change event of the dropdown to either wp-admin/admin-ajax.php or a custom JSON API endpoint (preferred but more work) with a payload like this

    new_status: 123
    post_id: 321

Ensure 100% that the user that is logged in has authorization to modify the post

$post = get_post( filter_var( $_POST['post_id'], FILTER_SANITIZE_NUMBER_INT ) );
if( /*Test User Auth*/ ){
    wp_set_post_terms( $post->ID, [ 
        filter_var( $_POST['new_status'], FILTER_SANITIZE_NUMBER_INT ) 
    ], 'status' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.