Decrease file size upload in Media

That number is taken from wp_max_upload_size(), and there is a filter: ‘upload_size_limit’. See wp-admin/includes/template.php. So this should work (not tested): add_filter( ‘upload_size_limit’, ‘wpse_70754_change_upload_size’ ); function wpse_70754_change_upload_size() { return 1000 * 1024; }

How to get Woocommerce order product info

Have tried your code and it works fine and infact it also gives out the details of each product in the orders. The code which i tried $filters = array( ‘post_status’ => ‘any’, ‘post_type’ => ‘shop_order’, ‘posts_per_page’ => 200, ‘paged’ => 1, ‘orderby’ => ‘modified’, ‘order’ => ‘ASC’ ); $loop = new WP_Query($filters); while ($loop->have_posts()) … Read more

Any guides on creating custom admin pages?

I pretty much started in the same place as you a while back, and have created something similar. Here’s what I think you need to know. 1) Work out how to create your basic hello world first and foremost. A simple plugin will consist of a few comments at the top of a PHP file … Read more

Why do templates contain so many PHP tag pairs?

As always, people copy paste whatever they learned from and IIRC the first style is the coding style of wordpress core. As you said yourself, when there is a big block of generated HTML it is easier to look at (and balance tags) under the first style, but pragmatic people will use the second whenever … Read more

PHP unit testing WordPress?

There is nothing stopping you from writing your own unit testing for themes/plugins using PHPUnit or some other testing platform. As for WordPress, it has an official Unit Tests here: http://unit-tests.svn.wordpress.org/trunk/ https://github.com/kurtpayne/wordpress-unit-tests (github mirror) There are several build scripts that can automate unit testing found here, including WP-CLI that have built in unit testing, though … Read more

How to get the custom header image’s alt text?

/** * Get custom header’s alt data. * * @link http://wordpress.stackexchange.com/q/151850/1685 * * @return string */ function wpse_151850_get_header_image_alt() { $attachment_id = 0; if ( is_random_header_image() && $header_url = get_header_image() ) { // For a random header, we have to search for a match against all headers. foreach ( get_uploaded_header_images() as $header ) { if ( … Read more