is_admin() returns false in save_post hook with Gutenberg editor
You could try with the following instead to detect if rest if ( is_admin() || defined( ‘REST_REQUEST’ ) && REST_REQUEST ) { }
You could try with the following instead to detect if rest if ( is_admin() || defined( ‘REST_REQUEST’ ) && REST_REQUEST ) { }
It’s not a good idea to store user’s data on a file that is publicly accessible. A better way would be to create a folder, and store your file under it. Also, it’s better to use WordPress’s filesytem class rather than directly using PHP’s built-in functions. Here’s a quick fix: function wpse381320_after_login( $atts ) { … Read more
I discover that it’s a know bug, and will be fix in future release Reference here So then, i used this code… not pretty, but do the magic !, thanks $content = do_shortcode( shortcode_unautop( $content ) ); if ( ‘</p>’ == substr( $content, 0, 4 ) and ‘<p>’ == substr( $content, strlen( $content ) – … Read more
I don’t know in what exact order filters are applied to the_content(); and whether that’s early enough, but if it doesn’t work for you, I believe it is safe to assume that you’re right in thinking that the shortcode is applied to late. From /wp-includes/shortcodes.php (line 296, wp 3.2.1) it can be seen that shortcodes … Read more
You can add your own AJAX API for do_shortcode. Add this to a suitable location (i.e. functions.php or a plugin): add_action(‘wp_ajax_doshortcode’, ‘ajax_doshortcode’); function doshortcode() { echo do_shortcode($_POST[‘text’]); die(); // this is required to return a proper result } And this to your Javascript: $.ajax({ url : ajaxurl, data : { action : ‘doshortcode’, text : … Read more
It a matter of using do_shortcode in your author.php template file (or wherever applies). This function has to be “echoed”. And instead of using the_author_meta (which echo‘s the result), use get_the_author_meta. <?php echo do_shortcode( get_the_author_meta( ‘description’ ) ); ?>
No, apparently not. Until this behavior is changed in version 3.7 you can add this filter to your theme’s functions.php file to include additional extensions. Edited: I’ve updated the filter with better code suggested in the comments. Lower case and uppercase extensions function my_custom_audio_extensions( $exts ) { //merge array of upper case extensions with default … Read more
In general, if arguments is not used or the defaults values are to used of an argument/parameter, you don’t have to write it out, they can simply be omitted. The only time when you have to pass any value to an argument is when a function expect a valid value to be passed to it … Read more
You need a couple of things. A shortcode handler, and a custom query: function wpse_186346_excerpt_length() { return 50; } function wpse_186346_excerpt( $atts ) { $atts = wp_parse_args( $atts, array( ‘posts_per_page’ => 2, // Any other default arguments ) ); // We don’t need paging, always save a query $atts[‘no_found_rows’] = true; // Create query based … Read more
To enable shortcodes in text widgets add a filter like that: add_filter( ‘widget_text’, ‘do_shortcode’ ); You can pass every string to do_shortcode() including get_theme_mod() calls. echo do_shortcode( get_theme_mod( ‘theme_setting’ ) );