Timeline for Updating user meta on save post
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 21, 2016 at 17:51 | vote | accept | charliek | ||
Mar 21, 2016 at 17:49 | comment | added | Howdy_McGee♦ | @charliek Good catch! Updated the answer and was able to test it successfully on my install. | |
Mar 21, 2016 at 17:49 | history | edited | Howdy_McGee♦ | CC BY-SA 3.0 |
added 11 characters in body
|
Mar 21, 2016 at 17:35 | comment | added | charliek | Have solved it. We we missing` $user_query->get_results()` | |
Mar 21, 2016 at 17:26 | comment | added | charliek | This throws the follow errors - Invalid argument supplied for foreach() in /.../functions.php on line 420 and Warning: Cannot modify header information - headers already sent by (output started at /.../functions.php:420) in /.../wp-includes/pluggable.php on line 1196 | |
Mar 21, 2016 at 14:07 | comment | added | Howdy_McGee♦ |
@charliek Whoops! Fixed that. WP_Query puts it's results into a posts[] array. Usually it's an array of Post objects ( $post->ID, $post->post_date, etc ) but since we're only returning 1 field (ID) it's returning an array in integers. Anyway, to access this array we need to loop through $user_query->posts instead. If this solves you issue please ensure th click the checkmark so future readers know it's solved!.
|
|
Mar 21, 2016 at 14:06 | history | edited | Howdy_McGee♦ | CC BY-SA 3.0 |
added 7 characters in body
|
Mar 21, 2016 at 14:02 | comment | added | charliek | Sorry only just got back round to this. Your answer looks excellent and I can follow the logic, however for some reason $user_id is passing an array of values(!) as opposed to the actual ID, any idea? | |
Mar 16, 2016 at 17:36 | comment | added | Christine Cooper♦ | I think you understood the question better than I did. :) | |
Mar 16, 2016 at 17:35 | history | answered | Howdy_McGee♦ | CC BY-SA 3.0 |