Wordpress add_meta_box() weirdness

后端 未结 3 854
眼角桃花
眼角桃花 2021-02-08 11:17

The code below is working nearly flawlessly, however my value for page title on one of my pages keeps coming up empty after a few page refreshes... It sticks for awhile, then it

3条回答
  •  醉酒成梦
    2021-02-08 11:47

    Wordpress's auto save system may well be your problem, as I think custom fields are not passed along for auto saves (so your customHeader and customTitle post variables will be empty during an auto save).

    In your save function you should check if the DOING_AUTOSAVE constant is set (this seems to be preferable to checking the post action) and return if so. Something like this:

    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    

    See this ticket for more info: http://core.trac.wordpress.org/ticket/10744

提交回复
热议问题