Monthly Archives: September 2018

WordPress Post Link Not Working

If you've been using WordPress for a good length of time now, you have likely come across a time when you published a post and tried to visit the page and it gave you a 404 not found error, right? Of course I'm right or you probably wouldn't be here reading this, so here are a couple common fixes you should try first when this happens.

Re-Save Permalinks

The first thing I always try is to simply go to wp-admin/settings/Permalinks and make sure the settings are correct and even if they are, save them again just by clicking the button at the bottom of the page even if you do not change a thing! This will often fix your problem, but not always.

Re-Name Your Post and Permalink

Sometimes simply giving your post a new name and changing the Permalink at the top of the page will resolve the problem as well. To do this, simply change the title by adding a word or two and then change the permalink right under the title by changing it to match the new title but make it all small letters and replace spaces with hyphens. One reason this might work is if you had accidentally used a reserved word for your title  or a title that exists for some other purpose in WordPress. When that happens it will simply ignore it and show you a 404 link instead usually. If you do not want to change your posts title, then you can probably get away with just changing the permalink right under the title, but you always have to change the permalink at least to be sure you're not using a reserved word or link that is already in use somewhere else within WordPress.

 

 

Basic WP Cron Jobs

This is going to be a simple WP Cron tutorial that explains the basic use of WordPress cron, the wp_schedule_event function and it's 3 built in intervals. I'll write a more complex one soon that explains how to add your own intervals, but this is a good starting point:

Practical Code Example

<?php
//Add function to register daily function on WordPress init
add_action( 'init', 'register_daily_cron');

// Function which will register the daily event:
function register_daily_cron() {
    // Make sure event hasn't been scheduled already:
    if(!wp_next_scheduled('daily_cron')) {
        // Schedule the event
        wp_schedule_event(time(), 'daily', 'daily_cron');
    }
}

?>