From a591591866f79584450dfb7d3b81014d220d4077 Mon Sep 17 00:00:00 2001 From: Fernando Jorge Mota Date: Mon, 22 Jul 2024 15:59:21 -0300 Subject: [PATCH 1/3] Do not set _filled and _featured on form to submit jobs As this will be handled in wp_after_insert_post later --- includes/forms/class-wp-job-manager-form-submit-job.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/forms/class-wp-job-manager-form-submit-job.php b/includes/forms/class-wp-job-manager-form-submit-job.php index 281cdd91a..7e1e70d5f 100644 --- a/includes/forms/class-wp-job-manager-form-submit-job.php +++ b/includes/forms/class-wp-job-manager-form-submit-job.php @@ -970,10 +970,6 @@ protected function create_attachment( $attachment_url ) { * @param array $values */ protected function update_job_data( $values ) { - // Set defaults. - add_post_meta( $this->job_id, '_filled', 0, true ); - add_post_meta( $this->job_id, '_featured', 0, true ); - $maybe_attach = []; // Loop fields and save meta and term data. From 000a66904f661c1364a002803b6524bc8b7d7640 Mon Sep 17 00:00:00 2001 From: Fernando Jorge Mota Date: Mon, 22 Jul 2024 16:00:50 -0300 Subject: [PATCH 2/3] Do not set _filled and _featured while calling save_job_listing_data --- includes/admin/class-wp-job-manager-writepanels.php | 4 ---- wp-job-manager.php | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/includes/admin/class-wp-job-manager-writepanels.php b/includes/admin/class-wp-job-manager-writepanels.php index 3fe9d76bc..a541ce0fa 100644 --- a/includes/admin/class-wp-job-manager-writepanels.php +++ b/includes/admin/class-wp-job-manager-writepanels.php @@ -673,10 +673,6 @@ public function save_post( $post_id, $post ) { public function save_job_listing_data( $post_id, $post ) { global $wpdb; - // These need to exist. - add_post_meta( $post_id, '_filled', 0, true ); - add_post_meta( $post_id, '_featured', 0, true ); - // Save fields. foreach ( $this->job_listing_fields() as $key => $field ) { if ( isset( $field['type'] ) && 'info' === $field['type'] ) { diff --git a/wp-job-manager.php b/wp-job-manager.php index 733ba8fb4..04581d041 100644 --- a/wp-job-manager.php +++ b/wp-job-manager.php @@ -21,7 +21,7 @@ } // Define constants. -define( 'JOB_MANAGER_VERSION', '2.3.0' ); +define( 'JOB_MANAGER_VERSION', '2.3.0-dev' ); define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); From fc3b10cf9b6d1ccff01b2ea9d816711ff013bd37 Mon Sep 17 00:00:00 2001 From: Fernando Jorge Mota Date: Mon, 22 Jul 2024 16:01:34 -0300 Subject: [PATCH 3/3] Call 'maybe_add_default_meta_data' method on 'wp_after_insert_post' --- includes/class-wp-job-manager-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wp-job-manager-post-types.php b/includes/class-wp-job-manager-post-types.php index 3d094140d..baa2b3ab8 100644 --- a/includes/class-wp-job-manager-post-types.php +++ b/includes/class-wp-job-manager-post-types.php @@ -205,7 +205,7 @@ public function __construct() { add_filter( 'wp_insert_post_data', [ $this, 'fix_post_name' ], 10, 2 ); add_action( 'add_post_meta', [ $this, 'maybe_add_geolocation_data' ], 10, 3 ); add_action( 'update_post_meta', [ $this, 'update_post_meta' ], 10, 4 ); - add_action( 'wp_insert_post', [ $this, 'maybe_add_default_meta_data' ], 10, 2 ); + add_action( 'wp_after_insert_post', [ $this, 'maybe_add_default_meta_data' ], 10, 2 ); add_filter( 'post_types_to_delete_with_user', [ $this, 'delete_user_add_job_listings_post_type' ] ); add_action( 'transition_post_status', [ $this, 'track_job_submission' ], 10, 3 );