You can try this (not tested):
// Add image sizes for book outside
add_image_size( 'book_portrait_thumbnail', '150', '215', true );
add_image_size( 'book_portrait_square', '300', '300', true );
// Delete all intermediate image sizes
add_filter( 'intermediate_image_sizes', 'custom_image_sizes', 99 );
function custom_image_sizes( $image_sizes ) {
//In case of book return book sizes array
if( isset($_REQUEST['post_id']) && 'books' === get_post_type( $_REQUEST['post_id'] ) ){
return array( 'book_portrait_thumbnail', 'book_portrait_square' );
}
// Otherwise the other ones
return $image_sizes;
}
Of course, this is for science sake. Like others suggested I would rather find a different hosting provider, this is not relevant for the current state of tech offer.
Related Posts:
- How to add a CSS class to every image in a Custom Post Type
- Image size filtering in Media uploader according to custom post type
- single-{$post_type}-{slug}.php for custom post types
- Row actions for custom post types?
- Saving Taxonomy Terms
- Why does my custom WP role need edit_posts to edit images?
- How to order posts of a custom post type by date DESC in dashboard Admin?
- List most recent image uploads, but only for specific custom post type
- How to correctly get post type in a the_title filter
- set_post_thumbnail_size in percent, not pixels?
- Best way to filter featured image text for a custom post type?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- post_type_link filter causes 404 on the CPT page it’s used on
- Debug output during filter execution doesn’t work
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- How to remove CPT comment feed from head?
- Unable to filter on field on edit.php page
- Help with issues on “Adding a Taxonomy Filter to Admin List for a Custom Post Type?”
- Uploaded image not appearing in custom post type
- Adding posts of custom type into the main feed
- Used with meta_query in query_posts works slowly
- Archive filter disappears on no results?
- Return Attachments from Custom Post Type
- How to get Custom Post ID by adding filter to child theme’s function
- Custom Taxonomy breaking pages permalinks
- How do I set the link in the Custom Post Type admin menu?
- Filter custom post type archive page with custom taxonomies (categories) with AJAX
- How to filter out post type meta?
- How to check if “is single” page
- Change post featured image on hover
- Make a function to run only for CPTs
- Modifying date filter on admin page for custom post type to link to custom field
- Pre_get_posts filter overwrites all search functionality
- WooCommerce product search titles only
- List all images from a single post meta value
- Custom Image Thumbnails of Different Sizes
- How to detect filter in URL in Category page?
- Custom query to filter posts that have current post as a taxonomy [closed]
- Append date to custom post type url slug
- How to move image thumbnails into custom folder for custom post type
- Genesis filterable portfolio isotope [closed]
- Hide editor while keeping add media button in custom post type
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- filter custom post type by meta key in dashboard
- Categories of custom taxonomy don’t show any posts
- How to add a post slug to a url?
- Add custom image size for custom post type or taxonomy
- WordPress sort search results by custom order
- How to automatically set ‘default image size’ for specific Custom Post Type
- How can I made custom taxonomies relationship?
- WooCommerce sort products by the actual product width(not the shipping width)
- Problem: wp_query outputs all images on site
- search suggest – filter post type
- Filtering posts list table
- frontend image post uploader
- Adding custom image sizes and post types to a plugin or to a theme?
- Create new custom post and post category of same name
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- REST filters only firing when I have a param set
- How do you output an unknown number of images in a custom post type with desired markup?
- Using Image Sizes for Custom Post Types outside the Loop
- link featured image to external link
- Modifying WP_Title For Custom Post Type
- Filtering the_content, but still need to display the unfiltered content inside filter
- Thumbnails Not Generating
- Returning an image url from its attachment ID using a custom post type plugin
- Not Able to Add New Class To CPT Attachment Image
- custom filtering admin columns
- Ajax Post Filter | Split Taxonomy Into minPrice & maxPrice
- Query filter by value in meta_value array
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Display category filters for custom post type when category is shared by multiple post types
- Dynamic page for nav items used as filters
- Create Post Types from a XML url (Real Estate website)
- Post Click Redirect to Custom URL instead of Single Post Page
- Change picture attachment meta of all occurrences of a picture
- Output all terms slugs for a loop filter
- Help Adding filter to Add Media button for custom post type
- Apply pre_get_posts to specific custom post type in the admin area
- Enable shortcodes on custom post type
- Filter between Custom Posts depending on meta_value
- Creating adminable dynamic filtering on custom post type
- Dropdown switching subcategories portfolio
- Filter wp_dropdown_categories Per Post Type
- Working with gallery shortcode and get gallery images
- Sorting on Taxonomy in archive page
- add current-menu-item to multiple custom post types
- Filter custom post type by tags
- Custom Search Template for Custom Post Types
- Allow authors to create article image
- Rewrite a filter as shortcode (or something like that) to use anywhere in CPT
- add_filter > posts_where works partially
- Simple Share Buttons Add Plugin and Custom Post Type
- Front end post or photo or both
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Filter page ID outside the loop and order
- Paginate yearly archives for a custom post type
- Using wp_insert_post to create custom posts with ACF image field