How to link to a page that has a shortcode?

Transients are probably not the way to go here.

From what I understand:

  1. You want to know if a post has a shortcode by doing some form of look up

  2. You want to be able to get a list of permalinks / posts that have this shortcode.

Here’s what I suggest.

/**
 * Checks for calender shortcode and flags the post with post meta.
 * @param integer $post_id
 * @return integer
 */
function save_calender_postmeta($post_id)
{
    // Make sure this isn't an autosave.
    if(!defined('DOING_AUTOSAVE') || !DOING_AUTOSAVE){
        // Get Post Content
        $content = get_post_field('post_content', $post_id);
        // Check for shortcode
        if(has_shortcode($content, 'class-schedule')) {
            // Update (or it will insert) the 'has_calender' post meta.
            update_post_meta($post_id, 'has_calender', '1');
        }
        else {
            // Delete the has calender post meta if it exists.
            delete_post_meta($post_id, 'has_calender');
        }
    }
    return $post_id;
}
add_action('save_post', 'save_calender_postmeta');

And then, if you want to get all the posts that have calenders you could use:

/**
 * Get all posts and their permalinks that have calenders.
 * @global wpdb $wpdb
 */
function get_calender_posts_links()
{
    global $wpdb;
    $rows = $wpdb->get_results($wpdb->prepare(
            "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s",
            'has_calender'
    ));
    if(!empty($rows)) {
        // Let's include the post permalinks with each row.
        foreach($rows as $row) {
            $row->post_permalink = get_permalink($row->post_id);
        }
    }
    return $rows;
}

Or if you wanted to check if a single post had a calender:

/**
 * Check if a post has a calender.
 * @param int $post_id
 * @return boolean
 */
function post_has_calender($post_id)
{
    return (get_post_meta($post_id, 'has_calender'));
}

Let me know if this is what you were looking for.

error code: 523