Skip to content

Instantly share code, notes, and snippets.

@sepehr125
sepehr125 / wp_secret_gateway_only_access
Last active August 29, 2015 14:14
Make a WordPress site inaccessible, except via a secret parameter in URL, which then grants access to site for number of days
/*
*
* Make a WordPress site inaccessible except via a secret
* parameter in the URL. Once that URL is visited,
* grant the visitor access for a number of days via a cookie.
*
* Gateway URL is of the form: example.com/?{{ secret }}
*/
add_action('init', 'secret_gateway_only_access');
jQuery( document ).ready( function( $ ) {
$('#s').autocomplete({
serviceUrl: '/wp-admin/admin-ajax.php?action=autocompleteCallback',
dataType: 'json',
paramName: 'term',
transformResult: function(response) {
return {
suggestions: $.map(response.results, function(dataItem) {
return { value: dataItem.title, data: dataItem.url };
})
@sepehr125
sepehr125 / 0_reuse_code.js
Created March 10, 2016 21:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console