WordPress variables and memory

Your installation might be … less than optimal. Using my Mini Theme, no plugins and the following code on the front page right after the opening body tag … print count( $GLOBALS ) . ‘ $GLOBALS<br>’; print @count( get_defined_vars(), 1 ) . ‘ variables<br>’; print count( get_defined_constants( TRUE )[‘user’] ) . ‘ constants’; … I … Read more

Programmatically adding images to the media library with wp_generate_attachment_metadata randomly fails

I have checked your code, and I think you are missing the guid of the images. Please have a look at the code below: $post_id = 1234; $images = array(‘filename1.png’, ‘filename2.png’, … ‘filename10.png’); // Get the path to the upload directory. $wp_upload_dir = wp_upload_dir(); foreach($images as $name) { $attachment = array( ‘guid’=> $wp_upload_dir[‘url’] . “https://wordpress.stackexchange.com/” … Read more

How to use more than 256MB of memory in the admin?

Theoretically, editing your config.php and add this line before wp-settings.php inclusion. define(‘WP_MEMORY_LIMIT’, ‘256M’); should raise your memory limit for WordPress to 256MB or whatever value you set. And this will work sitewide. However, as sorich87 pointed out, there are few functions that will alter this setting with hard coded 256 MB limit. To Hack or … Read more

WP_Query leaking absurd amounts of memory

Excellent responses on WP Hackers: http://lists.automattic.com/pipermail/wp-hackers/2012-June/043213.html What you’re doing with that query, is loading EVERY matching post into memory, including the full post contents. As you can imagine, this is probably quite a lot of items. You can pass ‘fields’ => ‘ids’ into WP_Query to simply return a list of matching post_ids instead, which should … Read more

How to configure WordPress to handle 75,000 pages?

The problem comes from the fact that, in order to display pages and their hierarchy, WP has to load all of them and then build the tree in memory. So, you are saved if you can convert most of those pages into one or several non-hierarchical custom post types. The permalink structure can be emulated.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)