Skip to content

Instantly share code, notes, and snippets.

@koskinenaa
koskinenaa / wordpress-filter-custom-post-types-by-custom-taxonomies.php
Last active November 16, 2020 12:15
Add filtering by custom taxonomies to a post type. Note when registering the custom taxonomies 'query_var' should not be set to false. If so, this function won't work,
/**
* Add taxonomy filtering to custom post types
*
* Original example for one post type, https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/
*
*/
function filter_cpt_by_taxonomies( $post_type, $which ) {
// Affected post types
$post_types = array(
'my_post_type',
@carlalexander
carlalexander / AdminPage.php
Last active January 27, 2024 14:07
WordPress and the single responsibility principle
<?php
namespace WPMemeShortcode;
/**
* The WordPress Meme Shortcode admin page.
*
* @author Carl Alexander
*/
class AdminPage
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048