Add Shortcode functionality to a function that queries custom post type / taxonomy
Add Shortcode functionality to a function that queries custom post type / taxonomy
Add Shortcode functionality to a function that queries custom post type / taxonomy
sanitize_textarea_field() will be stripping out the GMaps <iframe> element. Sanitize it with wp_kses( $store_map, $allowed ) instead, where $allowed is an array in the following format: $allowed = array( ‘iframe’ => array( ‘width’ => array(), ‘height’ => array(), ‘style’ => array(), ‘loading’ => array(), ‘allowfullscreen’ => array(), ‘referrerpolicy’ => array(), ‘src’ => array() ) ); … Read more
You can access the current query on a custom post type archive page with global $wp_query;. By using the global variable which holds the current query, you don’t need to do an additional query. To keep your header.php file cleaner, you could use actions and callback functions placed in your functions.php file to put the … Read more
“Page not found” while on page 2 from pagination menu
Step 1: Flush Rewrite Rules Manually: Visit Settings > Permalinks and click “Save Changes”. Programmatically (temporarily): function my_custom_flush_rewrite_rules() { flush_rewrite_rules(); } add_action( ‘init’, ‘my_custom_flush_rewrite_rules’ ); Step 2: Add Custom Rewrite Rules function custom_rewrite_rules() { add_rewrite_rule( ‘^products/([^/]+)/([^/]+)/?$’, ‘index.php?post_type=product&product_category=$matches[1]&name=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘custom_rewrite_rules’ ); Step 3: Modify post_type_link Filter function add_custom_rewrite_rule( $post_link, $post, $leavename ) … Read more
CPT meta values intermittently return empty
How can I allow plugin users to define layouts for a custom post type
You have just a little mistake in your preg_match, instead of this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches)/’, $rewrite) ) { do this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches\/)/’, $rewrite) ) { I was looking for a solution to clean a lot of rules, this source is useful: https://wpreset.com/remove-default-wordpress-rewrite-rules-permalinks/ My final code is this, it can be customized allowing more or … Read more
Multiple search forms and respective results page templates?
I am having a problem with fetching product data in the Gutenberg block editor