Schedule reminder at exact time

I have event website. I want send reminder about event exactly 2 hours before the event to subscribers. So how can schedule wordpress to call the function exactly at time. I know about wp_schedule and cron. But that doesn't helps me. Don't recommend plugins. Because I am developing custom plugin. So what is the correct way to do that. Example: if event start time is today 11:30 pm , I want to remind the event subscribers at exactly 9:30 pm.
Category: Web

All Wordpress scheduled posts are being published immediately

I am having a problem when creating scheduled posts. I create the posts as normal, click edit, set a scheduled time and click ok then the shedual button. Soon as i do this i check the website and the post has been published immediately. I looked back in the view all posts page and the post says its still scheduled. It was working fine for months but suddenly this is occurring. Really need this sorting asap! cheers
Category: Web

Sort scheduled posts in ascending order by default

I have a self-hosted WordPress blog (5.9). When I go to view scheduled posts, I want the default sort order to have the soonest scheduled posts on top. I can do this by manually hitting the date column header, or by visiting /wp-admin/edit.php?post_status=future&post_type=post&orderby=date&order=asc I have lots of posts scheduled for the far future. But I mostly want to see what I've got being published next week. Is there an action I can add to my theme - or a setting …
Category: Web

Scheduled Posts and wp-cron - Why don't scheduled posts publish if too old?

I notice that the documentation for wp_schedule_single_event mentions the following:- The action will fire off when someone visits your WordPress site, if the schedule time has passed. However this does not seem to be true for scheduled posts. I notice that some posts can be missed if wp-cron is not run for a while (not sure of exact timeframe). The post then has the label 'Missed Schedule' in the admin panel. My questions are:- Is this just for scheduled posts …
Category: Web

Unable to run custom CRON jobs on aws server

I am facing an issue with following code which is responsible to schedule a post to publish on some other website (developed in django). My code is able to publish the posts created in wordpress to django site from local server only (setup in docker image), but with same code snippet at AWS EC2 instance it fails to run the action defined in the scheduler. attaching a screenshot to understand all the default cron jobs are displaying to run in …
Category: Web

how to schedule update for published post on x date

I was looking for a solution for how to schedule updates for the published posts on x date. Since we can only schedule a post to publish in WordPress on X date/time so how can we schedule a post for republish. By doing this our content will be refreshed and the published date/time will also be changed. Any suggestion and help will be appreciated.
Category: Web

Adding $args to wp_schedule_event() causes hook to add infinitely to WP Cron

I'm working on calling my function from server cron instead of using WP Cron. The problem I occured is simple. When I add $args to wp_schedule_event() method, and check for the successfull addition in plugin called WPCrontrol, i see that on every page refresh the same hook is added over and over again. I have a function called generateXlsxFile() to whom I need to pass one variable boolean(true). Steps I tried so far: 1) if (!wp_next_scheduled('generateXlsxFile')){ wp_schedule_event(time(), 'daily', 'generateXlsxFile', array(true); …
Category: Web

Scheduling update post daily

I have created a function to change the post category to archive after expiry date. And it will update every time when I save a post. But the question is that how can I schedule an update for posts daily. Otherwise, the post will show in the frontend with outdated information. It would be great if anyone can help me. Thanks a lot! // Archive post after expired if ($expireTransient = get_transient($post->ID) === false) { set_transient($post->ID, 'set for 1 minutes', …
Category: Web

Scheduling wordpress posts

I'd like to schedule 1 post to be published every day until the total post count runs out, before cycling the process over again. Each of these posts must expire (revert to "draft" or "archived") after 7 days of "published" age. All of these posts would be under a custom post type. In total I will create 200 posts. All 200 posts must be published consecutively before the cycle begins again at post #1. Consequently every 7 days at a …
Category: Web

Why doesn't wp_update_post() update the post_status field?

I'm using this bit to insert/update a custom post type from the front-end. The date is set from a custom jquery datepicker. if (strtotime($date) < strtotime('tomorrow')) { $newpostdata['post_status'] = 'publish'; } elseif (strtotime($date) > strtotime('today')) { $newpostdata['post_status'] = 'future'; $newpostdata['post_date'] = date('Y-m-d H:i:s', strtotime($date)); } if ('insert' == $operation) { $err = wp_insert_post($newpostdata, true); } elseif ('edit' == $operation) { $newpostdata['ID'] = $post_id; $err = wp_update_post($newpostdata); } This works when first publishing the post, setting it correctly as publish or …
Category: Web

Make future posts visible to the public—not just within WP_Query

I know I can publicly show future posts in a loop using 'post_status' => 'future' in WP_Query. But clicking on a future post's permalink will result in a 404 if you are not a logged-in user. Suppose I have a post called Apocalypse in the post_type 'event', scheduled for 12-12-2099. The permalink is mysite.com/event/apocalypse. Is it possible to make mysite.com/event/apocalypse and other future 'event' posts visitable now by the public? Ideally I'd be able to restrict future post availability to …
Category: Web

Error trying to publish immediately. Post status = future (Missed schedule error)

We have moved a to new server and now we can’t publish. At least, we can’t publish instantly. Maybe can be useful: we are using Plesk & CloudFlare. When we publish a new post, the post_status value in wp_posts table is, automatically, future instead of publish We have already taken a look at this post with no lucky: https://wordpress.org/support/topic/publish-immediately-missing-and-scheduled-posts-fails/ What we have already done is: Checked server time Everything OK into site health info Disabled all plugins & changed to …
Category: Web

Change scheduled posts to published

I wrote the following function to change scheduled posts to published (I've got about 1000 of them). When I run the code below, the date change, but the status does not... Can anyone shed some light on this issue? This is the code I am using as of now: /* CHANGE PENDING POSTS TO PUBLISHED POSTS */ function change_post_status($post_id, $status, $change_date){ $current_post['ID'] = $post_id; $current_post['post_status'] = $status; $current_post['post_date'] = $change_date; wp_update_post($current_post); } $args = array( 'post_type' => 'post', 'posts_per_page' => …
Category: Web

Show custom content when loop or wp query reaches specific time?

Like Facebook, the birthday of a user will showing something like “month year day, you were born” on his timeline, or on someday it will show “graduated form ?? School”. Is it possible for Wordpress query or loop likely to show some custom content when date reaches special day? I know I can add a custom post type and set schedules, but if it comes to “birthday” or “anniversary”, cycles every year or month, custom post type way will be …
Category: Web

How do I change the permalink of a scheduled post so that it can be linked to?

When you create a post of any type (either post or page or custom taxonomy) it gets a permalink that visitors can click on and visit. http://example.com/my_first_blog_post_permalink/ However, if you Publish the post, BUT make the publish date in the future, the post is shown as 'Scheduled' in the Admin and the permalink shows like so: http://example.com/?p=2848 And then also, when I try to share the post on Facebook, it does not share properly (ie. the preview text and image …
Category: Web

Show scheduled posts in loop (but don't link to them)?

Is there a way to show scheduled posts in the regular loop but have them not link? I'd like to show that they're coming soon. This code makes them visible, but you can click into the post, which I don't want. add_action( 'pre_get_posts', function ( $wp_query ) { global $wp_post_statuses; if ( ! empty( $wp_post_statuses['future'] ) && ! is_admin() && $wp_query->is_main_query() ) { $wp_post_statuses['future']->public = true; } });
Category: Web

Disabled wp-cron, set up system cron but still have missed schedule posts

I have a caching plugin (WP Rocket) so I am aware of the issues with wp-cron and scheduled posts. So, I disabled wp-cron and then set up a system cron. Now, I noticed that when a post is scheduled it's not set to HH:MM:00 but has some number greater than 0 seconds. So, I set the system cron to run wp-cron at every 5 minutes and 35 minutes past the hour. And still I get missed schedule on posts. I …
Category: Web

"Missed schedule" posting bug

I have a low traffic WordPress (4.5.3) site at http://brandgrowmedia.ca/. When a blog post is scheduled, it frequently (~80% of the time) does not post and is marked as "Missed schedule". I looked into the problem and believed it was related to a cron task not firing because the site did not have enough traffic In an attempt to fix the problem, I installed the plugin WP-Cron Control. As per the plugin's instructions, I then logged into my cPanel and …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.