Skip to content

Instantly share code, notes, and snippets.

Renato Alves renatonascalves

Block or report user

Report or block renatonascalves

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
@renatonascalves
renatonascalves / bp-custom.php
Created Jul 12, 2019 — forked from imath/bp-custom.php
Registering REST Fields for the BP REST API
View bp-custom.php
<?php
// Registers a REST field for the Activity Endpoints.
function example_register_activity_rest_field() {
bp_rest_register_field(
'activity', // Id of the BuddyPress component the REST field is about
'example_field', // Used into the REST response/request
array(
'get_callback' => 'example_get_rest_field_callback', // The function to use to get the value of the REST Field
'update_callback' => 'example_update_rest_field_callback', // The function to use to update the value of the REST Field
@renatonascalves
renatonascalves / is_rest.php
Created Jun 10, 2019 — forked from matzeeable/is_rest.php
Checks if the current request is a WP REST API request.
View is_rest.php
<?php
if (!function_exists('is_rest')) {
/**
* Checks if the current request is a WP REST API request.
*
* Case #1: After WP_REST_Request initialisation
* Case #2: Support "plain" permalink settings
* Case #3: URL Path begins with wp-json/ (your REST prefix)
* Also supports WP installations in subfolders
*
@renatonascalves
renatonascalves / test.php
Created May 24, 2019 — forked from spacedmonkey/test.php
Add gutenberg blocks to WordPress API as json.
View test.php
<?php
add_action( 'rest_api_init', function () {
$types = get_post_types(
[
'show_in_rest' => true,
],
'names'
);
View wp_mail.md

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.9.

There are a few TODOs left. Please bear with me.

You can’t perform that action at this time.