Skip to content

Instantly share code, notes, and snippets.

@seancojr
seancojr / wordpress-firewall.php
Created April 6, 2016 03:16
This WordPress plugin investigates web requests with simple WordPress-specific heuristics to identify and stop most obvious attacks. Copy the following program to "wordpress-firewall.php" within your "wp-content/plugins/" folder. From: http://www.seoegghead.com/software/downloads/wordpress-firewall.seo
<?php
/*
Plugin Name: Wordpress Firewall
Plugin URI: http://www.seoegghead.com/software/wordpress-firewall.seo
Description: Blocks suspicious-looking requests to WordPress.
Author: SEO Egghead, Inc.
Version: 1.25 for WP 2.x
Author URI: http://www.seoegghead.com/
*/
@seancojr
seancojr / gw-gravity-forms-submit-to-access.php
Created April 4, 2016 05:37 — forked from spivurno/gw-gravity-forms-submit-to-access.php
Gravity Wiz // Gravity Forms // Submit to Access
<?php
/**
* Gravity Wiz // Gravity Forms // Submit to Access
*
* Require that a form be submitted before a post or page can be accessed.
*
* @version 1.1
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/submit-a-gravity-form-to-access-content/
@seancojr
seancojr / gw-gravity-forms-disable-submission-on-enter.js
Created April 4, 2016 05:33 — forked from spivurno/gw-gravity-forms-disable-submission-on-enter.js
Gravity Wiz // Gravity Forms // Disable Submission when Pressing Enter
<script type="text/javascript">
/**
* Gravity Wiz // Gravity Forms // Disable Submission when Pressing Enter
* http://gravitywiz.com/disable-submission-when-pressing-enter-for-gravity-forms/
*/
jQuery(document).on( 'keypress', '.gform_wrapper', function (e) {
var code = e.keyCode || e.which;
if ( code == 13 && ! jQuery( e.target ).is( 'textarea,input[type="submit"],input[type="button"]' ) ) {
e.preventDefault();
return false;
@seancojr
seancojr / gw-gravity-forms-export-multi-input-fields-single-colum.php
Created April 4, 2016 05:32 — forked from spivurno/gw-gravity-forms-export-multi-input-fields-single-colum.php
Gravity Wiz // Gravity Forms // Export Multi-input Fields in a Single Column
<?php
/**
* Gravity Wiz // Gravity Forms // Export Multi-input Fields in a Single Column
*
* By default, Gravity Forms only allows you to export each input of a multi-input field (e.g. Checkbox field,
* Name Field, etc) as a separate column. This snippet allows you to export all inputs (of a specific field) in a
* single column.
*
* @version 1.1
* @author David Smith <david@gravitywiz.com>
@seancojr
seancojr / gp-limit-choices-disable-limits-for-admins.php
Created April 4, 2016 05:30 — forked from spivurno/gp-limit-choices-disable-limits-for-admins.php
Gravity Perks // GP Limit Choies // Disable Limits for Admins
<?php
/**
* Gravity Perks // GP Limit Choies // Disable Limits for Admins
* http://gravitywiz.com/
*/
add_action( 'init', function() {
if( is_callable( 'gp_limit_choices' ) && current_user_can( 'administrator' ) ) {
add_filter( 'gplc_remove_choices', '__return_false' );
add_filter( 'gplc_disable_choices', '__return_false' );
remove_filter( 'gform_validation', array( gp_limit_choices(), 'validate' ) );
@seancojr
seancojr / gw-gravity-forms-skip-registration-for-logged-in-users.php
Created April 4, 2016 05:28 — forked from spivurno/gw-gravity-forms-skip-registration-for-logged-in-users.php
Gravity Wiz // Gravity Forms // Skip Registration for Logged in Users
<?php
/**
* Skip Registration for Logged In Users
* http://gravitywiz.com/2012/04/24/skip-user-registration-for-logged-in-users/
* Works for GF User Registration 3.0 and greater.
*/
add_filter( 'gform_is_delayed_pre_process_feed', 'maybe_delay_feeds', 10, 4 );
function maybe_delay_feeds( $is_delayed, $form, $entry, $slug ) {
if ( is_user_logged_in() && $slug == 'gravityformsuserregistration' ) {
return gf_user_registration()->has_feed_type( 'create', $form );
@seancojr
seancojr / gw-gravity-forms-manual-entries.php
Created April 4, 2016 05:26 — forked from spivurno/gw-gravity-forms-manual-entries.php
Gravity Wiz // Gravity Forms // Manual Entries
<?php
/**
* Gravity Wiz // Gravity Forms // Manual Entries
*
* Create entries manually for Gravity Forms. Adds an "Add New" button next to the page title on all entry-related pages.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@seancojr
seancojr / gw-gravity-forms-hide-ajax-spinner.css
Created April 4, 2016 05:24 — forked from spivurno/gw-gravity-forms-hide-ajax-spinner.css
Gravity Wiz // Gravity Forms // CSS // Hide AJAX Spinner
body img.gform_ajax_spinner {
display: none !important;
}
<?php global $wp_query; ?>
<?php
/**
* If query contains less than 2 parameters (so basically 1) and this is used on archive.php that probably means we only have the post_type parameter.
*/
if( count($wp_query->query) < 2 ):
?>
<p>Please select at least one filter above</p>
@seancojr
seancojr / wp-native-php-sessions.php
Created April 3, 2016 02:46
If you see an error like "Fatal error: session_start(): Failed to initialize storage module: user (path: ) in .../code/wp-content/plugins/plugin-that-uses-sessions/example.php on line 2" you likely have a plugin in the mu-plugins directory that is instantiating a session prior to this plugin loading. To fix, you will need to deactivate this plug…
<?php
/*
Plugin Name: MU WP Native PHP Sessions
Plugin URI: https://wordpress.org/plugins/wp-native-php-sessions/
Description: Building on Pantheon's and WordPress's strengths, together.
Version: 0.1
Author: Pantheon
Author URI: http://getpantheon.com
*/