Skip to content

Instantly share code, notes, and snippets.

View JuanBernal98's full-sized avatar
🏠
Working from home

Juan Bernal JuanBernal98

🏠
Working from home
View GitHub Profile
@JuanBernal98
JuanBernal98 / vpn
Created July 16, 2021 14:14
OpenVPN: Open your config.ovpn fast & easy
#!/bin/bash
# Force use with sudo
if [[ $(id -u) -ne 0 ]]; then
echo "ERROR: Operation not permitted."
exit 1
fi
CONFIG_DIR="$HOME/openvpn-profiles/"
@JuanBernal98
JuanBernal98 / functions.php
Created April 29, 2021 20:48
wordpress rest api disable
add_filter( 'rest_authentication_errors', function( $result ) {
if ( ! empty( $result ) ) {
return $result;
}
if ( ! is_user_logged_in() ) {
return new WP_Error( 'rest_not_logged_in', 'You are not currently logged in.', array( 'status' => 401 ) );
}
return $result;
});
@JuanBernal98
JuanBernal98 / wordpress-custom-admin-dropdown-filter-search-handler.php
Last active April 8, 2021 14:40
Wordpress - Create custom dropdown filter at wp-admin archives
<?php
/**
* Handles the search
*/
add_filter('parse_query', 'select_dropdown_filter_query', 10, 1)
function select_dropdown_filter_query($query)
{
// manual
$post_type = 'CUSTOM_POST_TYPE';