This could be done in the template that displays your archive page when only one post is returned by wp_query for a given category. Something like this:
if ( $wp_query->post_count == 1 && $wp_query->max_num_pages == 1 ) {
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );
exit;
}
Related Posts:
- Ordering get_terms with ACF not displaying all terms
- Is there a way I can return terms by name using a shortcode?
- Show shortcode without executing it
- How to create a shortcode with 1 parameter (atts)
- How does a shortcode work?
- Run visual composer code in php page
- Remove wptexturize from a shortcode?
- Using shortcode in Post title
- WordPress adds br in between my shortcode
- Audio or playlist shortcode condition according to the amount of files on attachment page
- WP_enqueue_script inside shortcode?
- Shortcode to Gutenberg-block: additional text on front-end and conditional display
- template_redirect to accompany with a shortcode
- Tinymce shortcodes within shortcode contents
- passing multiple parents value into a shortcode
- How do I preview the result of a shortcode in the TinyMCE editor?
- Conditionally loading Facebook PHP SDK in shortcode
- WordPress shortcode doesn’t working on HomePage
- Font Awesome Icons Won’t Work
- How to Get a part of URL and put in shortcode?
- detect when shortcode ran for the last time
- How can a shortcode can take the place of the featured image in a post?
- Shortcode for Twitter Bootstrap Collapse
- Is there any inherent difference between add_filter() and add_shortcode() for modifying [caption]?
- get_shortcode_regex() only matches first shortcode
- Looking for a way to include/embed text from a file on a page so that the short codes are processed
- Different uniqid when calld in wp_localize_script and shortcode
- How do I debug a short code?
- How to type shortcode-like text in WordPress TinyMCE visual editor?
- Does registering multiple shortcodes impact performance?
- Gallery shortcode – change link file image size? (not using default fullsize image)
- How can I hide the Permalink/Shortlink for certain user logged in Users of a certain level?
- How to force that styles are enqueued in the header?
- add action only if gallery shortcode attribute is equal to?
- How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
- Shortcode for order number [closed]
- Create shortcode in WordPress, using one variable in 3 functions?
- Adding javascript actions to words in post content
- My shortcode does not call the function
- Hide Selection of Text From Archive, but Show on Single Posts
- How to create an incremental list using shortcodes?
- Displaying shortcode in footer
- Displaying shortcode output through Options Framework
- How to Generate html tags using shortcodes?
- Do shortcode that is inserted in a textarea is not displaying properly
- Adding custom form within add_shortcode
- Use another action instead of the shortcode API to display the last time a user logged in
- wp_editor not rendering the shortcode
- how to add shortcode in wordpress container [duplicate]
- How to make this shortcode work for post content wordpress [duplicate]
- Get array of shortcodes within string
- stop WordPress removing shortcode from content [closed]
- Adding a custom field to do_shortcode [closed]
- Is it possible to handle two or more shortcodes in a single page?
- Toggle Shortcode Sanitize Title
- Clearfix Shortcode
- How and when to include shortcode source files
- Use full size images in a specific gallery
- contact form 7 database short codes [closed]
- how to create a fav icon shortcode?
- How to deal with WordPress bug: can’t use wrapped and unwrapped shortcode on same post
- Execute Shortcodes when submitting post
- Substituting value via shortcode
- Video shortcode, option are not rendered
- Create shortcode for each form field in contact form 7
- Auto embeds don’t work for attachment descriptions
- Shortcode to appear and show the date not code in Title and description of Social Media sites
- Displaying an interactive web map on my wordpress site
- Date Shortcode in Image alt and title tags
- access shortcode atts in template part
- how to add shortcode widget at end of main blog page
- Shortcode is not showing content when placed in editor (post_type = page)
- May an attribute have no value?
- How to set up posts per page on WP
- How to insert a short code into Contact Form 7 in WordPress that will call a function once the submit button is pressed
- SQL query to bulk change short code in all posts
- Display shortcode in text field with wordpress settings api
- Unable to make shortcode, what is wrong?
- How to display a page dependent on a url parameter supplied by a form/button page?
- How do i remove Business feeds Shortcode fatal error
- Push Shortcode parameter to template
- latest posts shortcode with image
- WordPress plugin shortcodes not outputting anything
- WordPress Gallery with ID’s Shortcode not Working
- Featured image with link to post shortcode, image displaying above the post
- Video shortcode inside tabs shorcode NOT working
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- How to add meta slider lite or other slider to main page header in pinboard theme
- Escaping a shortcode so it displays as-is [duplicate]
- WordPress do_shortcode first iteration
- If do_shortcode is blank, return some message
- Add a short code to a plugin
- Previous/Next with the same category
- I’ve broken the short code for Contact Form 7!
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode
- Add widget/shortcode to sidebar OUTSIDE of the theme
- How to remove https:// from shortcode generated url
- How to exclude some cats from wp_list_categories using shortcut
- How can I create a shortcode that shows a list of categories on the single product page?