Skip to content

Instantly share code, notes, and snippets.

View coltjones's full-sized avatar

Colt Jones coltjones

View GitHub Profile
@andrewspear
andrewspear / functions.php
Last active July 6, 2017 08:10
Wordpress function to force Facebook to refresh it's cache as a scheduled post
<?
// Ping Facebook with (via a POST request) to refresh the cache (scrape) for a scheduled post as it is published
// Relevant docs: https://developers.facebook.com/docs/opengraph/using-objects#selfhosted-update
// Place this in your Wordpress functions.php file
add_action('transition_post_status', 'purge_future_post', 10, 3);
function purge_future_post($new_status, $old_status, $post) {
if($new_status == 'publish') {
@leandersikma
leandersikma / facebook_purge.php
Last active September 18, 2016 17:43
Problem with Facebook cache: Page not Found on future posts in Wordpress
<?php
// Issues with sharing posts on Facebook: http://www.passwordincorrect.com/issue-with-sharing-wordpress-posts-to-facebook/
// Add this chunck of code in your functions.php or anywhere else in your theme files.
// Register action for post status transitions
add_action( 'transition_post_status' , 'purge_future_post', 10, 3);
// Check if the new transition is publish, for correctness you could check if $old_status == 'pending', but I want that every post (which is published) is cached again (just to be sure).
@btoone
btoone / curl.md
Last active November 3, 2024 23:34
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin