Archived topic
Hooks disappeared after database restore
8 replies · Started by Giacomo on July 16, 2019
Hi, I made a restore of the wordpress database. After that I saw that my hooks code disappeared. It is not present either in the new element legacy hooks section a
or in the old one.
Could you please help me to solve this problem?
Best regards,
Giacomo
Hi there,
There is no way for us to retrieve your code unfortunately.
I would recommend checking with your host to find a backup that still has your hooks content and restore to that one.
Hi Leo, thanks for your answer.
I restored the database and the website with a backup made yesterday (before the accidentally deletion of part of wp_posts table) but the hooks code is still missing.
Then I found an old hook export made from Generatepress setting page (generate-hooks-export.json). The import completed but the hook code continue to be missing.
Have you any idea to solve my problem?
Thanks for support.
Best regards,
Giacomo
Hi there,
Are you using the old hook system?
If so, is "GP Hooks" activated (or present) in "Appearance > GeneratePress"?
Yes, I am still using the old hook system and it is visible and active in Appearance > GeneratePress. But when I access to the old (now called legacy) hook page, I find it empty and there is not any effect of my hook code into the website.
For me it is not a problem to switch to the new solution if you indicate to me where I can find the my hook code so I could move it.
Thank you for your support.
Best regards,
Giacomo
Hi again, I solved the problem... I found in the db my hook code inside the option table (generate_hooks row) and I reinserted it in the legacy hook page after having renamed the hook row in the db.
Now the website works again well but I haven’t yet understood what the cause of the problem was. Do you have any idea?
Best regards,
Giacomo
I'm not sure why that would have happened. The table in the database should be backed up/restored like any other table.
Glad you got it sorted :)
Hi, I have the same problem but I'm not sure how to fix it. I go to Apperance > Elements > Legacy hooks. Here I can only create. All scripts I've previously added with hooks are gone. But they are still working!
And when I check phpMyAdmin generate_hooks table, I see all my scripts. So what should I do? Should I just cut the code from the table and paste the code in new element hook?
Thanks,
Karl
Hi there,
sounds like cutting and pasting from the database would be the best solution.