v1.6.1
This commit is contained in:
parent
fd2880bece
commit
1f7343cd9d
1 changed files with 55 additions and 68 deletions
|
|
@ -97,6 +97,14 @@ class Frontend_Profile {
|
|||
* @return string
|
||||
*/
|
||||
public function render_shortcode( $atts ): string {
|
||||
// Content filters (including shortcodes) also run on REST requests,
|
||||
// e.g. when the editor autosaves a post that mentions the shortcode
|
||||
// in its text. Rendering there is useless and has side effects
|
||||
// (such as generating an OTP secret), so bail out early.
|
||||
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -123,6 +131,17 @@ class Frontend_Profile {
|
|||
return '';
|
||||
}
|
||||
|
||||
// settings_errors() and submit_button() are defined in wp-admin
|
||||
// includes that are not loaded on frontend or REST requests (the
|
||||
// shortcode also renders when content filters run on REST autosaves).
|
||||
// Load them on demand.
|
||||
if ( ! function_exists( 'settings_errors' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/misc.php';
|
||||
}
|
||||
if ( ! function_exists( 'submit_button' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/template.php';
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue