Skip to content

Instantly share code, notes, and snippets.

View wpbullet's full-sized avatar
💭
Find me https://guides.wp-bullet.com/codeable-hire

WP Bullet wpbullet

💭
Find me https://guides.wp-bullet.com/codeable-hire
View GitHub Profile
<?php
/*
Plugin Name: Subscriber Redirect Fix
Plugin URI:
Description:
Version:
Author:
Author URI:
License:
License URI:
//Disallow direct access
defined( 'ABSPATH' ) or die( 'No Access' );
function wpb_bring_admin_back() {
if ( is_user_logged_in() && current_user_can('manage_options') ) {
add_filter( 'show_admin_bar' , '__return_true' );
show_admin_bar( true );
}
}
<?php
defined( 'ABSPATH' ) or die( 'No Access' );
/**
* Plugin Name: Force Redirects
* Description: Allows admins default behavior and all other users get redirected to where they came from or to the homepage
* Author: Mike Andreasen
*/
/**
@wpbullet
wpbullet / xml.py
Last active October 18, 2018 11:15 — forked from chrisguitarguy/xml.py
Parse an XML sitemap with Python, requests and BeautifulSoup
from __future__ import with_statement # we'll use this later, has to be here
#!/usr/bin/env python2.7
# Author Mike https://guides.wp-bullet.com/
# Forked from https://gist.github.com/chrisguitarguy/1305010
from argparse import ArgumentParser
import csv
from itertools import izip
import requests
from BeautifulSoup import BeautifulStoneSoup as Soup
<?php echo PHP_VERSION; ?>
@wpbullet
wpbullet / images-in-comments-error
Created March 22, 2017 23:19
fix bluehost images in comments redirect 404 error
# fix images in comments error
<Files *.php>
SetInputFilter PHP
LimitRequestBody 5242880
</Files>
@wpbullet
wpbullet / logs-viewer.php
Created March 23, 2017 18:29
logs-viewer.php
<!DOCTYPE html> <html lang="en"> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/styles/default.min.css">
<title>Logs Viewer</title>
<style media="screen">
body {
font-family: sans-serif;
@wpbullet
wpbullet / gist:83a573b6617c09a673116572061d8f46
Created July 9, 2017 21:54
disable-ajax-threshold-woocommerce.php
/ Begin Show 180 variations when loading page.
function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 400;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );
// END Show 180 variations when loading page.
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
@wpbullet
wpbullet / get-user-role.php
Last active July 27, 2017 03:09 — forked from kellenmace/get-user-role.php
Get user role in WordPress
<?php
/*
* Get user's role
*
* If $user parameter is not provided, returns the current user's role.
* Only returns the user's first role, even if they have more than one.
* Returns false on failure.
*
* @param mixed $user User ID or object.
* @return string|bool The User's role, or false on failure.