This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function clear_email( array $contact ) { | |
$clean = []; | |
foreach ( $contact as $contact_key => $contact_value ) { | |
if ( is_array( $contact_value ) ) { | |
$clean[ $contact_key ] = clear_email( $contact_value ); | |
} | |
elseif ( is_email( $contact_value ) ) { | |
$email_parts = explode( '@', $contact_value ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var display_posts_template_revised = wp.template( 'display-posts-revised' ); | |
$.post( ajax_url, request, function( response ) { | |
response.data.forEach( function ( post ) { | |
$('#display_posts').append( display_posts_template_revised( post ) ); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'edit_form_top', 'add_parameters_to_preserve_in_post_form' ); | |
/** | |
* Add a new input in Post form if 'go-back-to-plugin' is a URL parameter. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/edit_form_top/ | |
* | |
* @return void | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_after_insert_post', 'redirect_back_to_plugin', 100, 4 ); | |
/** | |
* Redirects back to custom plugin page if Post is created with | |
* $_GET['go-back-to-plugin'] present. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/wp_after_insert_post/ | |
* | |
* @param int $post_id The post ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_after_insert_post', 'redirect_back_to_plugin', 100, 4 ); | |
/** | |
* Redirects back to custom plugin page if Post is created with | |
* $_GET['go-back-to-plugin'] present. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/wp_after_insert_post/ | |
* | |
* @param int $post_id The post ID. |