Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow duplication on all post statuses #2780

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions includes/class-wp-job-manager-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,6 @@ public function get_job_actions( $job ) {
'nonce' => $base_nonce_action_name,
];
}

$actions['duplicate'] = [
'label' => __( 'Duplicate', 'wp-job-manager' ),
'nonce' => $base_nonce_action_name,
];
break;
case 'expired':
if ( job_manager_get_permalink( 'submit_job_form' ) ) {
Expand Down Expand Up @@ -509,6 +504,21 @@ public function get_job_actions( $job ) {
break;
}

/**
* Filter the post statuses that are allowed to be duplicated.
*
* @since $$next-version$$
*
* @param array Post statuses to filter - default is just 'publish'.
*/
$post_status = apply_filters( 'job_manager_allowed_post_status_duplicate_jobs', [ 'publish' ] );

if ( in_array( $job->post_status, $post_status, true ) ) {
$actions['duplicate'] = [
'label' => __( 'Duplicate', 'wp-job-manager' ),
'nonce' => $base_nonce_action_name,
];
}
$actions['delete'] = [
'label' => __( 'Delete', 'wp-job-manager' ),
'nonce' => $base_nonce_action_name,
Expand Down
Loading