At first look it was simple, just:

but, this way we can get ONLY posts, not pages. To get both posts AND pages just add:

in WP_Query arguments list so it will look like this:

And voila – we have both content types.

I faced with such problem: had one upload field for one file in my Zend_Form, and few checkboxes for choosing file destination. After form is submitted, this one file should be uploaded to each locations checked in form. So first idea was to loop through checked checkboxes, in each iteration set:

then do:

and it should be done, but its not. Problem is in

which is called BEFORE loop, and which can’t be modified INSIDE loop. After each receive() file is marked as already received and is not processed again. My solution was not state-of-art but works: files are received BEFORE checkbox loop, added to array, then loop is done and each file is copied where it should be. It looks this way:


From time to time previously serialized array will get broken. The most common problem occurs when string length is invalid so instead of

you have

becouse someone edited something directly in db, in this case to make php unserialize() function to work again, just do this magic:

and you will get all strings lenths to be fixed again.