Automattic / Automattic/WP-Job-Manager

Update post date when job listing is approved

Open
#1,652 2 comments 3 reactions 0 assignees View on GitHub
Enhancement
Dominant language
PHP
Stars
899
Forks
369
Avg merge
11h 37m
Merged PRs (30d)
12

Description

It has been requested (1689684-zen) that we update the post date to the day the post is approved upon approval. Their reason for this is it may cause confusion when a new post shows up but the relative datestamp is "posted 2 days ago."

This makes sense to me. We could put it behind a filter if we think some people will want to maintain the initial posted date.

For now, this snippet will add the functionality:
```php
add_action( 'pending_to_publish', function( $post ) {
if ( 'job_listing' !== $post->post_type ) {
return;
}
$post_date = current_time( 'mysql' );
wp_update_post( array(
'ID' => $post->ID,
'post_date' => $post_date,
'post_date_gmt' => get_gmt_from_date( $post_date ),
) );
} );
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the job listing approval flow and the pending_to_publish hook in the plugin. Compare that flow with the provided snippet and verify that approving a job_listing updates its post date while other post types remain unchanged; the work is done when the approved listing shows the approval date.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, content
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.