Add form after woocommerce admin order edit

You can use the other action which called before wp_footer. You can use action “in_admin_footer” // define the in_admin_footer callback function action_in_admin_footer() { global $pagenow, $current_page, $post; //$current_page->post_type === ‘shop_order’ if( $pagenow == ‘post.php’ && !empty( $_GET[‘action’] ) && $_GET[‘action’] == ‘edit’ && $post->post_type == ‘shop_order’ ) { // make action magic happen here… } … Read more

widget_posts_args not using the number of posts in widget

The problem is that you’re not modifying the existing arguments for the widget, you’re replacing them: add_filter(‘widget_posts_args’, function() { $params[‘post_type’] = array(‘post’, ‘recipe’); return $params; }); The result of that filter will be: $params = [ ‘post_type’ => [ ‘post’, ‘recipe’ ] ]; So any other arguments, including the default number of posts, are removed. … Read more

Use core block functionality in a custom block gutenberg

There may be several other issues interacting here, but the big one is here: function onSelectImages(media) { const imagesUrl = values({…media}).map((item, i) => { return ({id: item.id, url:item.url}); }) setAttributes({ selectedImages: (values({…imagesUrl})) }); } When images are picked, you grab the images and set them as the selected images. This is not the same as … Read more

page template as a custom post type archive page

You can give people an actual Page to edit, and the permalinks you want, by setting up a rewrite when you create the CPT. Note: you will need to replace all instances of ‘mycpt’ with your actual CPT slug. <?php function wpse_360965_register_cpt() { // First unregister this post type so we’re starting from scratch unregister_post_type( … Read more

How to get dropdown instance value in WordPress custom Widget

The cat_drop setting is empty because your drop-down menu, or the select field doesn’t have the proper name value, so PHP isn’t receiving the selected option/value. So to fix the issue, just add the proper name value to the select field: <!– Wrapped for brevity. –> <select name=”<?php echo $this->get_field_name( ‘cat_drop’ ); ?>” id=”<?php echo … Read more

how to create custom post type with dynamic category_name using shortcode

The arguments for your myCPT() function are incorrect. Callbacks used for add_shortcode() received two arguments, in this order: An array that contains the parameters used with the shortcode. The that is between the opening and closing shortcode, if supported. You code is assigning the attributes to $query (and then overwriting them), and trying to get … Read more

Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?

You can limit a search to a particular post-type quite easily: https://www.wpbeginner.com/wp-tutorials/how-to-limit-search-results-for-specific-post-types-in-wordpress/ Or a nice simple way to limit a search to a particular category by adding a hidden field into the search form: https://www.wpexplorer.com/limit-wordpress-search/ In terms of post vs page for custom post types, you can find the differences on the documentation page for … Read more