« first day (1977 days earlier)      last day (3266 days later) » 

03:37
@MarkKaplun this has been a long time coming... If it were me; I'd have making this priority #1 a long time ago. I cannot believe you have a team of developers, happily plodding along knowing full well there is no unified form API. I've wrote my own form API (agnostic to WP) but which I am now using to create a unified meta/form API across all areas of WP that we often use them from posts, users, taxonomy, settings, customizer and custom plugin pages as well as providing a unified way to...
...render forms in the front end (themes). That aside though, I wonder if this will spell the end for those metabox frameworks like ACF, metabox.io.
03:56
@userabuser, people (I mean me) spent years to understand the settings API, now need to learn a new trick :(
But options !== meta, and there is more to it then just handling the html forms. I can see how the settings api can be replaced without much pain but the meta is basically a way to extend the posts objects and like with rest, there is a huge step of defining what is a post and how you should extend it in favour of hacking some code
ACF provides so much more then the fields API at its current form, I will be surprised if it will be affected
*huge step being skipped
btw, when I said few days a go that I am less impressed with pippin's code was because in one of his samples he has an hybrid of settings API and html based form, and hybrids usually inherit the worse of all worlds :)
04:18
From a coding POV, the biggest problem that holds core development back is that contributors are still stuck at the DB structure, GUI elements details level, when wordpress had become complex enough it needs someone to be an architect. Assuming core wants to be OOP when it grows, you need to stop focusing on coding detaisl and start defining things in terms of object interactions. Untill you do that all the classes in the world will not make your code less procedural then it is
Maybe matt should hire someone in the caliber of @toscho as core architect to fix this problem
Not sure wp core devs care much about oop
they do, but they don't understand it
or at least they know code should be orgenized in logical components, and OOP has more buzz then other methods
 
1 hour later…
05:23
@MarkKaplun interesting point, will be good to see how this pans out, whether the fields API is a flop or not... though, whatever it is, it should replace all existing apis; which means breaking-changes. Having two APIs for the same thing co-exist gets messy because of the ecosystem (poor usage).
Re: pippins code... I've seen some questionable things in older architecture, but everyone does some question stuff from time to time.
> Assuming core wants to be OOP when it grows, you need to stop focusing on coding detaisl and start defining things in terms of object interactions. Untill you do that all the classes in the world will not make your code less procedural then it is...
exactly.
05:50
Looking at the code … the new Fields API should be deprecated from day 1.
5
haha immediate star
lol!
just having a read through now
I can see how this can become difficult to reason about: github.com/sc0ttkclark/wordpress-fields-api/blob/develop/…
if(){if(){foreach(){foreach(){foreach(){if(){}}}}}} … what could possibly go wrong?
if... if... foreach... coworker walks in "hey what you doing for lunch"... ahh where the fk was I again....
Sometimes on first pass if I am being a bit slack and want to get a working prototype up, I might do some deep nesting, but I'll always abstract it away into easy to reason about methods because if you leave it and then come back to it at some point in future (even though you wrote it) you will still be somewhat confused as to wtf is going on...
06:19
wow
lol @toscho, I was just trying to be polite and didn't say that before. For me it is actually the use of even more globals IIRC
Yeah, it is just shit. No need to wrap that up in nice words.
lol
there's a number of globals that are new, $wp_fields, but I also see $title, $parent_file, $submenu_file... never seen those before in core
ah well there you go, they do exist in core
When I had much less white hair I have been thought that functions should not be longer then the number of lines you can fit in a screen and a half. I see how it is hard to do when you do html output, but it still irks me, and that function doesn't do any output. With the foreach I can actually live
but there are great comments there "$object_type - object type" :)
wouldn't have figured that out if not for the comment
06:33
exactly, a life saver :)
they could have done away with the need for global $wp_fields though... once you start going down that path, you know you've got problems with your API design
When you commit to no globals it at the very least forces you think about better design principals.
exactly
well, we will see how this will end. I know that I would not even think about attempting such a thing before having full unit test coverage of all the core admin screen.
And I don't think there is
there's a tests dir but... tests aside, you can't really be serious about committing that into core?
now @userabuser, please stop being rude and aggressive and try being constructive :)
06:50
it's wonderful, I love it, let's commit it now to core, I want to hold hands and sing kumbaya...
LOL
They also copied a customizer bug and initialize on wp_loaded instead of init. I think I will avoid even trying to figure out why it is done that way.
i didn't bother looking at the customizer part, first thing I always look at is the Field API itself how low level it is and agnostic to the higher level API used to call it...
I looked into it because scot said on slac that its structure was the inspiration for the fields api, so just wondered if that bug (?) was just a copy/paste thing and if it happens also in the customizer
yeah I just read that on the github landing page "Based on the Customizer, we can enable developers to do more because they won't have to jump between different interfaces."
hmm
or in other words "we had only 90% success of confusing developers, lets go for 100%" :)
07:03
lol
must... destroy... developer...
 
2 hours later…
09:04
Stack Exchange updates: 15K users can\'t protect question if it has no answers from new users.
posted on March 15, 2016

15K users can't protect question if it has no answers from new users.

 
2 hours later…
10:54
yet another thing I didn't want to know about php.... if you have an array which includes the value 0 a call to in_array will match every string against it. How could anyone at any time think it is an acceptable behavior? (yes, there is a "strict" parameter, but I assume every developer stumbles over this at least once)
11:04
@MarkKaplun yeah pretty backwards thinking... I've never been tripped up by it fortunately, if I'm using it, I'm usually checking the same types, but as you point out, it's a serious gotcha otherwise
Kind of reminiscent of the empty() quirk with (string) 0
 
6 hours later…
16:54
Quick question: Anyone know why an ajax update_post_meta change in the page edit window would appear get "rolled back" when the user clicks the "Update" button in the interface?
I have some post meta displayed in the page template. When the user updates it via ajax in the page edit screen, the change appears on the front-end view of the page until the user hits "Update" in the page edit screen.
Are you custom adding this AJAX? I'm not sure WordPress saves any metadata via ajax by default.
I'm using add_action( 'wp_ajax_...', 'callback')
It's a custom ajax action
Are you also saving it in the save_post hook?
Not that I'm aware of. Is the save_post hook a better way to save meta in the page edit screen?
Not if you're wanting to save it via AJAX. The save_post hook is just to grab and update data on the Update Button click
If you're just trying to save metadata then save_post is a much easier hook but it sounds like ajax is your goal
17:09
Not necessarily. It would be fine to just use the save_post hook, except for the fact that my interface is done in jquery. Guess I'd have to push the value into a hidden field or something?
I would maybe, turn on the debug log and throw some error_log()s into your ajax function to ensure it's catching. Maybe disable any caching plugins ( or all plugins you can ) for the time being.
Hidden field is also a solid option. Do you get any JS notices back? What's the response you get?
My ajax function echos this in the response: (is_wp_error($result)) ? 'error' : 'success';
It's returrning 'success' consistently.
$result being the return value of update_post_meta
It's getting set; it's just getting unset somehow on update. Really weird.
I don't think update_post_meta returns a WP_Error Object but false if it doesn't update successfully.
So that conditional will always be true
17:12
Oh.... yeah, that would be a problem.
Still--the change is visible on the front-end until the page is updated.
So when you save the post it overwrites it?
That's what it appears like.
My notes for reproducing the bug:
Open page
Open edit screen for that page
Change hero image position
Refresh page and observe that change has taken effect
Update page
Refresh page and observe that change has been reversed
Hmm, what are you calling the metavalue?
I doubt it's a reserved name but..
The exact call is update_post_meta($_POST['post'],'ohHeroPosition',$_POST['percent']);
I would also check your custom fields to ensure there's no value with the same name
17:15
k
Oh, I bet that's it.
Doesn't update_post_meta always create a custom field?
So I'd have to set that value from my script or the ajax change would be overwritten.
I think you can prefix your key with _{metakey} to make it private
Sweet.
Literally that whole string or just the underscore?
_ohHeroPosition
Got it.
Works perfectly!
0
Q: How to hide meta box values from custom fields list?

Foolish CoderI have created a metabox : function drama_description_metabox_markup() { global $post; $drama_description_metabox_markup = get_post_meta( $post->ID, 'drama_description', true ); ?> <div> <label for="meta-box-text">Description</label> <textare...

17:23
Thanks, man; that would have taken me ages to figure out on my own.
Great! Glad that worked out for you
Gonna go upvote that right now.

« first day (1977 days earlier)      last day (3266 days later) »