Timeline for Function/filter or plugin to change post status based on custom field value
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 5, 2014 at 23:33 | vote | accept | amespower | ||
Nov 5, 2014 at 23:32 | comment | added | amespower | I didn't have a lot of luck with this initially, made all my posts pending and then back again to published. What I ended up doing was echoing out all the unapproved ids based on the meta info and then using wp_update_post on that array to change them to pending. Not the best solution probably but it worked. Final code above in original question. Accepting your answer also as it does in fact work. | |
Oct 27, 2014 at 21:01 | comment | added | jetlej | Any luck on debugging? | |
Oct 26, 2014 at 20:58 | comment | added | jetlej | Also make sure you have PHP debugging turned on so you can see any errors (in wp-config.php) | |
Oct 26, 2014 at 20:56 | history | edited | jetlej | CC BY-SA 3.0 |
added testing
|
Oct 26, 2014 at 20:54 | comment | added | jetlej |
I would also include echo $the_query->post->ID; in the loop to make sure you're actually getting some matching posts with that query. Just updated my response with both testing methods.
|
|
Oct 26, 2014 at 20:51 | comment | added | jetlej |
Try echoing wp_user_post to see if it returns a post ID or just 0.
|
|
Oct 26, 2014 at 20:48 | comment | added | amespower | Thanks for your response, but no luck with that. I tried it both ways and tried with other loops on index.php removed, so only that remained, reloaded and nothing happened. Any ideas why? | |
Oct 26, 2014 at 17:42 | history | answered | jetlej | CC BY-SA 3.0 |