Callback to custom field is not working in WordPress REST API
Callback to custom field is not working in WordPress REST API
Callback to custom field is not working in WordPress REST API
You don’t have to use do_shortcode inside your shortcode callback function. But if you don’t do this, then you won’t be able to nest shortcodes, so other shortcodes added on the site won’t work inside it. Let’s say your shortcode callback looks like this: function a_shortcode($atts = [], $content = null) { //use content here, … Read more
Are you sure you have created that menu and associated it with with “secondary” menu location? Just asking…
Ok, after searching a while, I’ve found out that the “easy” solution to my problem would be to start by creating tabs (like in the appearence menu) and option sections. While I’m still no expert in that matter, I followed this 3 part guide that explains pretty much everything related to the matter. I just … Read more
wp_die(); will run AFTER the post is published. You are checking whether the post is published or not, which means the post is already published, what’s done is done. You can update to post status from published to draft instead of using wp_die();. The following code will do it: function check_post_limit( $ID, $post ) { … Read more
Did you try var_dump on the array_merge & avatar parameters? That would tell you if the variables are what you expect. Anyway – it looks like you have the parameter order wrong. You are using custom_comment( $comment, $depth, $args ) but it should be custom_comment( $comment, $args, $depth ) Hope that helps
If this is your request data for an AJAX POST: data: { action: ‘gs_order’, nonce_data: ajax_vars.nonce, product_groups: $(this).data(“pgid”), products: $(this).data(“pid”) }, Then you access product_groups and products like this: $data = [ ‘product_groups’ => $_POST[‘product_groups’], ‘products’ => $_POST[‘products’], ]; Just make sure you sanitize and escape the data as required. If they’re going to be … Read more
You need to add a fifth parameter to add_settings_field() that contains the section slug, $settings_slug_name.
The solution is simple: has_block( ‘simpetoc/toc, $YOUR_POSTS_CONTENT_OR_POST_ID ) https://developer.wordpress.org/reference/functions/has_block/ has_block( string $block_name, int|string|WP_Post|null $post = null ) There is no need to render the blocks to build a table of contents, nor should you do it that way. Note that your current approach breaks user defined HTML anchors and doesn’t account for headings in nested … Read more
You can use add_feed( $url, $callback ). Despite its name it sends a text/html Content-Type. Basic example: add_action( ‘init’, ‘wpse_50841_register_extra_page’ ); function wpse_50841_register_extra_page() { add_feed( ‘wpse50841’, ‘wpse_50841_callback’ ); } function wpse_50841_callback() { print ‘<p>It works!</p>’; } Visit the permalink settings page once to refresh the rewrite cache, and go to example.com/wpse50841/ or example.com/?feed=wpse50841 to see … Read more