• matoma16

    (@matoma16)


    Hi, I have troubles saving the data of the meta box in the link part of the admin.
    My code is working, because when I try it in the post or page part, it saves the data, but in Links it just won’t.

    Here is my code. Should I write something else instead of ‘save_post’ ? I saw some used ‘save_link’ ans tried even though people replying said it didn’t exist, but it doesn’t work…

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thank you for your help !

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter matoma16

    (@matoma16)

    I can’t figure out how to edit my post… here’s the code
    https://pastebin.com/ADwWLvzz

    rfair404

    (@rfair404)

    The post meta box and save functions look okay. What is the Problem? What does this mean: “but in Links it just won’t.”

    You might be able to hook into _transition_post_status but for your purpose, save_post should work fine.

    Thread Starter matoma16

    (@matoma16)

    Thanks for the reply. I mean that it works when I add it to post or page, but when I change ‘page’ (or ‘post’) to ‘link’ when I add the meta box, nothing is saved, and my input comes back blank when I go to the link form again, when I should have the link of my image. The data isn’t saved in the database either and I have no idea why.

    I’ll look into _transition_post_status, thanks

    rfair404

    (@rfair404)

    ok now I get it.

    For one try to uncomment the global $post on line 21 of your paste.

    Also might try replacing $object->ID with $post->ID on line 27.

    Just a guess at the moment. I have never made meta boxes for links but I imagine that it is the same as other post types.

    Thread Starter matoma16

    (@matoma16)

    Not working unfortunately ??

    I think there must be something different with Links, but I can’t figure it out / find anything about it on my searches.

    Thread Starter matoma16

    (@matoma16)

    Hi..
    I figured out how to save the data, but I still have a problem that I found today…
    On all links posts saved before I finally figured how to save the data, the data will save, BUT on links posts that I posted today, it won’t save my metabox. when I edit the posts from today, it won’t save the metabox either. if I edit the posts from friday, it saves, even if the field was empty before. Anybody has a solution ? I was so happy to finally having figured it out and now I have another problem…

    here’s my code
    https://pastebin.com/F02tcVX3
    Thanks !

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with meta box in Links’ is closed to new replies.