Skip to content

Instantly share code, notes, and snippets.

Stanislav Khromov khromov

Block or report user

Report or block khromov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
khromov / wp-config.php
Last active Oct 1, 2019
Convert MySQL connection string to wp-config.php parameters
View wp-config.php
// This will usually be received from an env variable, for example $connectionString = getenv('DB_URL');
$connectionString = 'mysql://';
// The values below will be your default values if $connectionString is empty.
$dbConfig = array_merge(
'host' => 'localhost',
khromov /
Created Jul 12, 2019
Amazing Marvin webhook

Webhook for Amazing Marvin

In order for this to work you need to fetch your Zapier token from Marvin Settings > Strategies > Zapier integration > Settings.

However, you don't actually need a Zapier for this to work, just send the request from your favourite framework.

khromov / fix-broken-instagram.php
Last active Mar 1, 2018
Fix broken / overlapping Instagram embed for WordPress
View fix-broken-instagram.php
* Plugin Name: Fix broken Instagram oEmbed
* Description: Fixes an issue with Instagram posts being broken when multiple posts are oEmbedded.
* Version: 1.0
* Author: khromov
* Remove Instagram embed.js script on each embed
khromov / infogram-oembed.php
Created Oct 19, 2017
Infogram oEmbed plugin
View infogram-oembed.php
Plugin Name: Infogram oEmbed
Plugin URI:
Description: Adds oEmbed support for and urls.
Author: khromov
Version: 1.0
Author URI:
khromov / disable-rest-api-for-anonymous-users.php
Created Oct 13, 2017
Disable WordPress REST API for anonymous users
View disable-rest-api-for-anonymous-users.php
Plugin Name: Disable REST API for anonymous users
* Remove all endpoints except SAML / oEmbed for unauthenticated users
add_filter( 'rest_authentication_errors', function($result) {
if ( ! empty( $result ) ) {
khromov / acf-nowhere-location-rule.php
Created Oct 2, 2017
"Nowhere" location rule for Advanced Custom Fields - never matches
View acf-nowhere-location-rule.php
Plugin Name: Advanced Custom Fields: Nowhere location rules
Description: Adds a "Nowhere" location rule in ACF
add_filter('acf/location/rule_types', function($rules) {
$rules['Extra']['nowhere'] = 'Nowhere';
View rock-paper-scissors-js.html
<!DOCTYPE html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<title>Rock, Paper, Scissors</title>
*{margin:0;padding:0;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}::selection{background:#fb9fe5;text-shadow:none}a{color:#0088CC;text-decoration:none;outline:0}a:hover{color:#005580}a img{border:none}img{max-width:100%}html{font-size:100%}body{padding:5%;font:300 1.25em/1.6 monospace;background:#fff;color:#000;}h1{font-family:"Helvetica Neue",sans-serif;line-height:1;font-weight:300;margin-bottom:1em;}.game{padding:2em;background:#eee;}
khromov / deploy.php
Last active Jun 23, 2019
Deploying WordPress with Deployer 4
View deploy.php
namespace Deployer;
require 'recipe/common.php';
set('ssh_type', 'native');
set('ssh_multiplexing', true);
// Set configurations
set('repository', '');
khromov / print-tax.php
Created Mar 15, 2017
Print taxonomy terms starting from specific slug in WordPress
View print-tax.php
* Plugin Name: Print taxonomy terms starting from specific slug
* Description: Usage: [print_taxonomy slug="product-category"] or <?php echo do_shortcode('[print_taxonomy slug="product-category"]'); ?>
add_shortcode('print_taxonomy', function($atts, $content) {
$atts = shortcode_atts( array(
'slug' => '',
), $atts, 'print_taxonomy' );
khromov / functions.php
Created Feb 14, 2017
Load WPFacet facets from facets.json file in theme
View functions.php
add_filter( 'facetwp_facets', function($facets) {
//Load facets.json file located in theme folder
$imported_facets = json_decode(file_get_contents(trailingslashit(dirname(__FILE__)) . 'facets.json'), true);
//Import facets
foreach($imported_facets['facets'] as $single_facet) {
$facets[] = $single_facet;
You can’t perform that action at this time.