Skip to content

Instantly share code, notes, and snippets.

View endurtech's full-sized avatar

Manny Rodrigues endurtech

View GitHub Profile
@endurtech
endurtech / .htaccess
Last active July 17, 2019 18:22
Redirect HTTPS traffic to HTTP
# Redirect HTTPS to HTTP
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@endurtech
endurtech / remove-replace-discussion-metabox.php
Last active July 17, 2019 21:04
Remove Option to Allow trackbacks and pingbacks when Editing Posts in WordPress
<?php
/*
** Disable Existing Discussion MetaBox
*/
add_action( 'admin_menu', 'remove_discussion_meta_box' );
function remove_discussion_meta_box()
{
remove_meta_box( 'commentstatusdiv', 'post', 'normal' );
}
@endurtech
endurtech / gravity-forms-hide-backend-tooltips.php
Last active July 17, 2019 21:04
How to Disable or Hide Gravity Forms Tooltips in Backend
<?php
/*
** Gravity Forms Hide All Backend Tooltips
*/
add_filter( 'gform_tooltips', 'hide_gf_tooltips' );
function hide_gf_tooltips()
{
return array();
}
@endurtech
endurtech / new-window-external-link-manual-selector.css
Created July 17, 2019 21:11
CSS which display link icon on external links which open a new window or tab for web accessibility.
@endurtech
endurtech / example1.htaccess
Last active July 17, 2019 21:44
Completely disable access to XMLRPC.php for WordPress (example1), example 2 disables but permits specified IP address(es)
# Disable access to xmlrpc.php
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>
@endurtech
endurtech / gravity-forms-custom-select-all-specific.php
Last active July 17, 2019 21:54
Custom Checkbox "Select All" Label For All Forms or a Specific Form
<?php
//Custom Checkbox "Select All" Label For Specific Form (Replace _FORMID, example _4)
add_filter( 'gform_checkbox_select_all_label_FORMID', 'cform_checkbox_select_all_label', 10, 2 );
function cform_checkbox_select_all_label( $select_label, $field )
{
    return "MY CUSTOM LABEL";
}
?>
@endurtech
endurtech / enfold-remove-editor-type-backend.php
Created July 17, 2019 21:58
Remove the frontend and backend notice of present editor type from admin bar when using Enfold WordPress Theme
<?php
add_filter( 'display_post_states', 'remove_ALB_post_state', 999, 2 );
function remove_ALB_post_state( $post_states, $post )
{
if( !has_blocks( $post->ID ) )
{
unset( $post_states['wp_editor'] );
}
if( != Avia_Builder()->get_alb_builder_status($post->ID) )
@endurtech
endurtech / wordpress-permissions-fixer.php
Last active July 11, 2025 14:07
Simple php script sets correct directory and file permissions on WordPress and others. Directories are 755, files are 644, .htaccess and wp-config.php is 444.
<?php
/*
** Plugin Name: WordPress Permissions Fixer
** Plugin URI: https://endurtech.com/how-to-fix-wordpress-file-and-folder-permissions/
** Description: Simple php script sets correct directory and file permissions on WordPress and others. Directories are 755, files are 644, wp-config.php is 444.
** Author: Manuel Rodrigues
** Author URI: https://endurtech.com
** Version: 1.1
** Tags: wordpress, php, script, directory, directories, file, files, wp-config.php, chmod, fix
** License: GPL-2.0+
@endurtech
endurtech / gravity-forms-file-upload-image-resizer.php
Last active July 20, 2019 13:43
UNTESTED - Gravity Forms Image Upload Resizer
<?php
// Gravity Forms Image Upload Resizer. Replace _1 with your Form ID
add_action( "gform_after_submission_1", "gf_resize_images", 10, 2 );
function gf_resize_images( $entry, $form )
{
// Replace 2 with field ID of upload field
$url = $entry[2];
$parsed_url = parse_url( $url );
$path = $_SERVER['DOCUMENT_ROOT'] . $parsed_url['path'];
@endurtech
endurtech / debug-pending-updates.php
Last active December 22, 2019 19:34
To find out which plugin or theme is generating the pending update notice on your WordPress installation, add the following code to your functions.php file of the currently active theme or child-theme (preferred). Once saved to your functions file, append ?debug_updates to your WordPress backend URL after /wp-admin/. Example, "http://yourwebsite…
<?php
/*
** Debug Pending WordPress Plugin Updates
**
** Quick debugging method to output all pending plugin/theme updates for admin level user.
** To use, visit yourwebsite.com/wp-admin/?debug_updates replacing YourWebsite.com of course.
** https://endurtech.com/wordpress-shows-a-pending-plugin-update/
**
** Special thanks to Kevin Leary