Skip to content

Instantly share code, notes, and snippets.

View celsobessa's full-sized avatar

Celso Bessa celsobessa

View GitHub Profile
@celsobessa
celsobessa / check-hooked-actions-filters.php
Last active February 21, 2019 14:43
Helper functions for developing and debugging WordPress plugins and themes
/**
* Prints all actions and filters hooked to a given hook.
*
* Prints all actions and filters hooked to a given hook.
* Inspired by answers in this WordPress Stackexchange question: https://wordpress.stackexchange.com/questions/17394/how-to-know-what-functions-are-hooked-to-an-action-filter
*/
function what_is_hooked(){
$hook_name = current_filter();
global $wp_filter;
@celsobessa
celsobessa / wordpress_export-post-data.php
Created July 16, 2018 04:08 — forked from robinnorth/wordpress_export-post-data.php
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@celsobessa
celsobessa / shortcodes-in-custom-fields.php
Last active May 15, 2018 19:50
Usando shortcodes WordPress em campos customizados (WordPress shortcodes in custom fields)
// opção 1: função do_shortcode
// veja https://developer.wordpress.org/reference/functions/do_shortcode/
echo do_shortcode( $content, false );
// opção 2: o filtro the_content
// veja https://developer.wordpress.org/reference/hooks/the_content/
echo apply_filters('the_content', $content);
// pega um campo customizado em post e passa para do_shortcode
// veja https://developer.wordpress.org/reference/functions/get_post_meta/