Skip to content

Instantly share code, notes, and snippets.

View aguilar1181's full-sized avatar

Raul aguilar1181

View GitHub Profile
aguilar1181 / gravity-limit-users-improved.php
Last active September 28, 2016 18:13
This snippet limits users, ip, role to a submission every certain time
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to
* the visitor's IP address, the user's ID, the user's role, a specific form URL, or the value of a specific field.
* These "limiters" can be combined to create more complex limitations.
* @version 2.7
* @author David Smith <>
aguilar1181 / remove-cpt.php
Created August 6, 2018 21:54
use this on a child theme functions to disable custom post types created by pre-made themes
//Unregister post type
function delete_post_type(){
add_action('init','delete_post_type', 100); //priority has to be higher than the register action
aguilar1181 / woo-custom-field-admin-search.php
Last active June 13, 2019 15:36
Admin search improvement to look in custom fields
//Improve admin custom search
function custom_search_query( $query ) {
$custom_fields = array(
// put all the meta fields you want to search for here
$searchterm = $query->query_vars['s'];
// we have to remove the 's' parameter from the query, because it will prevent the posts from being found
aguilar1181 / woo-custom-admin-filter.php
Last active June 13, 2019 15:37
Woocommerce Custom Admin Filter Dropdown
//Add custom filter dropdown to admin for CPT
function wpse45436_admin_posts_filter_restrict_manage_posts(){
$type = 'post';
if (isset($_GET['post_type'])) {
$type = $_GET['post_type'];
//only add filter to post type you want
if ('product' == $type){
aguilar1181 / all_fields_extra_options.php
Created June 21, 2019 18:09 — forked from bhwebworks/all_fields_extra_options.php
The Gravity Forms {all_fields} merge tag in notifications includes all fields which had data entered, it doesn't include HTML fields, Section Break descriptions, nor does it allow you to omit fields from the notification. By adding the following code to your themes functions.php file you will gain the ability to include HTML fields, and Section …
* to exclude field from notification add 'exclude[ID]' option to {all_fields} tag
* 'include[ID]' option includes HTML field / Section Break field description / Signature image in notification
* see for a list of standard options
* example: {all_fields:exclude[2,3]}
* example: {all_fields:include[6]}
* example: {all_fields:include[6],exclude[2,3]}
add_filter( 'gform_merge_tag_filter', 'all_fields_extra_options', 11, 5 );
function all_fields_extra_options( $value, $merge_tag, $options, $field, $raw_value ) {
aguilar1181 / woo-custom-columns.php
Last active July 10, 2019 20:59
Woocommerce Custom Colums from Custom Fields
//Add custom columns to admin page
add_filter( 'manage_edit-product_columns', 'show_product_order', 15 );
function show_product_order($columns){
$columns['COLUMN_NAME'] = __( 'LABEL'); //Add this for each new column and change LABEL and COLUMN_NAME
return $columns;
//Get Custom Columns values from fields
function custom_columns( $column, $post_id ) {
aguilar1181 / bricks-opening-tag.php
Created December 7, 2022 01:51
It adds an element righ after the <body> openning tag using Bricks builder own action.
* It adds an element righ after the <body> openning tag
* using Bricks builder own action.
add_action( 'bricks_body', 'my_body_open_tag', 0 );
function my_body_open_tag() {
echo 'my own tag here';
aguilar1181 / wp-preload.php
Last active February 11, 2023 20:50
add to WordPress themes functions.php to preload assets without a plugin
* Preloading WordPress assets without a plugin.
* Change function name to something more unique.
* Priority is set to 0 to include as high in the <head> DOM as possible. Change priority if needed.
* Use WordPress is_page() to target specific page or is_front_page() to target ONLY homepage as in Option #1
* If asset needs to be preloaded globally use Option #2.
* For multiple assets clone the link tag instead of the entire echo block.
* Change 'as' attribute accordingly. Values for 'as' can be found here
* Use abolute paths. For external assets paste the url, for internal assets use WordPress functions to construct URL.
aguilar1181 / wp-link-format-redirect.php
Last active May 11, 2023 12:57
Redirect a post format link to a ACF custom field
aguilar1181 / Yoast-SEO-database-cleanup.sql
Last active November 8, 2023 16:10 — forked from jdevalk/DB-cleanup.sql
Cleanup Yoast SEO plugin leftovers after uninstalling it.
-- Replace 'wp_' with your prefix if you changed it.
-- This removes all rows from the wp_postmeta table.
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots' AND meta_value = 'index,follow';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-noindex' AND meta_value = '0';