Hey folks,
I’m working on a WordPress project and could use some guidance regarding Quick Edit functionality.
I have a custom post type called “Project” with two custom fields: “Project Type” (taxonomy) and “Team Size” (post meta). I’ve set up a hook to update the “Team Size” field whenever the “Project Type” field is changed. However, the hook only seems to work with regular edits, not Quick Edit.
Here’s my current code:
`function update_team_size($post_id) {`
`if (!current_user_can(‘edit_post’, $post_id)) {`
`return;`
`}`
`if (‘project’ === get_post_type($post_id)) {`
`$types = wp_get_post_terms($post_id, ‘project_type’, array(‘fields’=> ‘names’));`
`update_post_meta($post_id, ‘team_size’, sizeof($types));`
`}`
`}`
`add_action(‘save_post’, ‘update_team_size’);`
Any suggestions on how to make this work with Quick Edit would be greatly appreciated!
[ad_2]