First, change those =
to ===
as mentioned by @sally-cj in the comment.
On top of that, you’re saving the status as a variable called $stat
and are then checking it as $status
. So you might want to change $stat = get_post_status($job->ID);
into $status = get_post_status($job->ID);
.
Or better: the $job
is already populated with a field called post_status
, so use $post->post_status
.
Related Posts:
- Is it possible to have more “levels” of draft/published statuses?
- What is a “protected” post status?
- how to assign a status/mark to post?
- Why doesn’t wp_update_post() update the post_status field?
- register_post_status and show_in_admin_all_list
- Changing post status in one click
- How can I run custom function when post status is changed?
- WP_Post_List_Table::get_views – Have post counts account for filters?
- Creating/editing custom ‘post-state’
- Using arbitrary post status without registering it
- Get a list of ALL Statuses both registered and built-in
- Adding custom post status to visibility in publish meta box
- Changing post status
- Change scheduled posts to published
- Include Drafts or Future posts with count_user_posts?
- Remove ‘private’ and ‘pending review’ options from post status dropdown
- Can not get future_to_publish to work
- Which is the better way to get the status of a post?
- “Publish immediately” with custom post status
- Modify Post Status Arguments
- Additional page and post status types
- Add a simple JS Alert Box on Post Submission
- Function to change post status IF current user and post author are the same
- Schedule future post to custom post status instead of publish?
- Why does get_post_status display published when attachment is in trash?
- Force Custom Post Type Status to ‘Future’ on first Save or Publish
- Workflow for attachments in WordPress
- how to transition to custom post status on post save
- How to change custom post type status when non-admin updates post?
- Custom post status filter links always show a count of all posts in the site with that status, not the logged in users count
- wordpress post status inquery
- Multiple Post Status
- Any way to change post/page status when editing page?
- How to change post status from “draft” to “publish”?
- transition_post_status doesn’t work with bulk updates
- Submitted for Review back to a Draft page
- How to Add Custom Post Status in WordPress Admin
- Auto draft posts when scheduled date is reached
- Changing a post status name
- How to update post status to draft if user role is “pending’
- How to create posts with a specific date in bulk
- How to Get All Posts with any post status?
- Restrict a Post Types Post Status
- Setting post meta data to random value during post status transition / on publish
- How to Get All Posts but the Private ones?
- Detect type of post status transition
- change a post status when users update posts?
- How to change post status from publish to draft using hook in wordpress?
- How can I style future post?
- Hiding by default specific post status on backend list?
- Comments Feed & Custom Post Statuses
- update_post_meta() not working when used with WordPress action
- why do drafts return as part of wp_query?
- Custom Post Status Posts viewable to the public
- How does WordPress track that a certain User is Logged-In
- Getting the different post statuses + count like in edit.php, in a custom submenu page
- $error = 404 after caught add_rewrite_rule
- add filter to “quick edit menu” in wordpress admin
- What differences are there between a Privately Published post and a Draft post?
- How to integrate blog status?
- Update post status from “publish” to “trash” for half of posts
- Is it possible to change an existing post status from ‘pending’ to ‘publish’ via email?
- how to remove dash (-) post status from post title on posts listing page wordpress
- Wp_query Add specific pending posts
- Change name of existing post status type
- Can’t schedule post for another time
- Send email with custom fields after new draft is saved or new post published
- change woocommerce product statut (draft ->publish // publish->draft) depends on the month [closed]
- Update postmeta Parent when post_status child change
- Wrong post_status notice after wp_insert_post_data
- Individual post. Meta_key, taxonomy or post status for separation?
- Allowing user to edit posts based on the post status
- Removing all post statuses from a Custom Post Type
- Count posts by type including drafts and pending posts
- Does the WP_Query ‘private’ argument for post status only apply to privately published content?
- $post->post_type not working
- how can i allow users to view their own pending posts in a front-end page
- Alternative to new_to_publish Hook for Custom Statuses
- How can I specify the post status of an untrashed post?
- Include future posts in tags and in search
- Is there a way getting post fields using `transition_post_status`
- Also show terms that are related to draft and pending posts
- Post Status Frontend Announcement
- Display amount of pending posts in back/front end
- Showing posts for today and future
- Manually adding or updating CPT automatically sets post_status of future
- How to return a 410 code for previously published posts now set to draft?
- Custom product status get filtered on all product list views
- Woocommerce – Remove cart button depending product (post) status
- Update post status from “publish” to “trash” prior to year 2018
- Hide or remove custom post status
- Put page on Archived statut after end of publication date
- get_next_post() not working with future post status
- Custom status and permalinks don’t work?
- date archive future posts
- Include attachments with a custom taxonomy in search
- Override private status – Enable users to read private posts
- Custom Query for searching through custom fields
- Change post status by custom fields
- transition_post_status hook, works – but not if the post is new