How to skip the creation of landscape thumbnails for an original portrait image

You were headed in the right direction. There is another filter out there that handles intermediate_image_sizes_advanced. You can add or remove custom sized thumbnails in there. Rather than NOT creating your landscape custom sizes on a Portrait upload, maybe try to only create the landscape custom sizes on a landscape upload. add_filter( ‘intermediate_image_sizes_advanced’, function( $sizes, … Read more

How to create interactive charts on WordPress?

It is possible to create interactive charts on a WordPress site. This will require custom code on your end to accomplish, but several JavaScript libraries exist that can help facilitate this. I have created custom charts using javascript libraries such as D3.js. Here is a great resource to get you started: https://getflywheel.com/layout/how-to-add-charts-to-your-wordpress-site-using-d3-js/.

get_post_gallery with Gutenberg

Using birgire’s suggestions, I came up with the following solution that is working well with both the old pre-WP 4.x data and the newer posts that have been added under 5.0. // if there is a gallery block do this if (has_block(‘gallery’, $post->post_content)) { $post_blocks = parse_blocks($post->post_content); $ids = $post_blocks[0][attrs][ids]; } // if there is … Read more

wp_download_url() for dynamically generated image

Without more information, it’s hard to tell what the reason is, for a specific answer you might want to show your code. The following uploads the lady to the media library: $url=”https://res.cloudinary.com/demo/image/upload/w_400,h_400,c_crop,g_face,r_max/w_200/lady.jpg”; // $post_id = 0 to not attach to specific post media_sideload_image( $url, 0 ); If you’re outside /wp-admin, you’ll need: require_once(ABSPATH . ‘wp-admin/includes/media.php’); … Read more