Title: WordPress bible example
Last modified: August 19, 2016

---

# WordPress bible example

 *  [lukich](https://wordpress.org/support/users/lukich/)
 * (@lukich)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/)
 * I have picked up a copy of WordPress Bible and started to go through it. However,
   at the example where we create our first plugin I hit a brickwall. Basically,
   here’s the file I have created called copyright-notices.php
 * I repeated the code identically to how it’s listed on the book, and it opens 
   in the Admin section, but doesn’t let me save the footer info in the database.
   Here’s the link to the full code of the plugin:
 * [http://pastebin.com/VbrBYmXA](http://pastebin.com/VbrBYmXA)
 * One weird thing I noticed is that in the form we use copyright_notices_text whereas
   when I update an option, it says copyright_notices_test. I think it’s a typo,
   but when I tried to syng them nothing happened. Also, what exactly does the last
   line mean:
    add_action(‘load-copyright-notices.php’,’save_copyright_notices’);
   in the code example online it looks different, like so: add_action( ‘load-plugins_page_copyright-
   notices’, ‘save_copyright_notices’ );
 * I tried all combinations, but neither one worked. The only thing between changes
   I made was refresh the page. Maybe there should be a different way to reload 
   the plugin info in order for it to get notices?
 * Any thoughts are very welcome.
    Thanks! Luka

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [ivaylo123](https://wordpress.org/support/users/ivaylo123/)
 * (@ivaylo123)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422261)
 * Hi Luka,
    I tried the same example, and finally run the plugin. I used …. if(
   update_option( ‘copyright_notices_text’, stripslashes( $_POST[‘copyright_text’]))){…
   There is a typo: copyright_notices_test of the place of “copyright_notices_text”
 * And second, to hook that I used:
    add_action( ‘load-plugins_page_copyright-notices’,‘
   save_copyright_notices’ );
 * I don’t know what that is ‘load-plugins_page_copyright-notices’.
    I am trying
   to figure out what that is.
 * Ivaylo
 *  [ivaylo123](https://wordpress.org/support/users/ivaylo123/)
 * (@ivaylo123)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422263)
 * me, again
 * it works also with:
    add_action(‘admin_menu’, ‘save_copyright_notices’);
 * Ivaylo
 *  [ivaylo123](https://wordpress.org/support/users/ivaylo123/)
 * (@ivaylo123)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422268)
 * j’ai trouvé que ça que j’ai écrit avant ne marche pas vraiment.
 * La solution est:
    if(isset($_POST[‘copyright_text’])) add_action( ‘load-plugins_page_copyright-
   notices’, ‘save_copyright_notices’ );
 * Ivaylo 🙂
 *  Thread Starter [lukich](https://wordpress.org/support/users/lukich/)
 * (@lukich)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422269)
 * Thanks for your suggestions. I still can’t get it to work. For some reason, whenever
   I change the last line to either
 * `add_action( 'load-plugins_page_copyright-notices', 'save_copyright_notices' );`
 * or
 * `add_action('admin_menu', 'save_copyright_notices');` and try to go to the plugin
   page, I get an “Are you sure?” message. Something is obviously wrong with the
   way I have it now.
 * When investigating further, I found that using either one of these two actually
   throws a 403 error in Apache, so I changed it to
 * `add_action( 'load-plugins_page_copyright-notices.php', 'save_copyright_notices');`
 * and it worked in a sense that I can get to the plugin page, but when I submit
   nothing really happens. At some point it did save the option name, but now it
   refuses to override it. Do you mind posting your block of code so I can compare
   them?
 * Thanks a lot!
    Luka
 *  Thread Starter [lukich](https://wordpress.org/support/users/lukich/)
 * (@lukich)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422270)
 * When I posted I noticed you added another response. That, unfortunately, doesn’t
   work either. But my request for your version of the code still stands. Also, 
   what’s the correct procedure to debug/troubleshoot? Do I need to deactivate/reactivate
   the plugin as I make changes? Do I need to restart the server/db?
 * Thanks again.
    Luka
 *  Thread Starter [lukich](https://wordpress.org/support/users/lukich/)
 * (@lukich)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422271)
 * Nevermind, it worked. Human error 🙂 Thank you !
 *  Thread Starter [lukich](https://wordpress.org/support/users/lukich/)
 * (@lukich)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422273)
 * Sorry for all the spam, but just curious – how do you debug? I’m new to WP, so
   I want to find out about the good practices as possible early on.
 *  [ivaylo123](https://wordpress.org/support/users/ivaylo123/)
 * (@ivaylo123)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422281)
 * Hi,
    I am also new to WP 🙁 I change the code and I look what happens. I used
   a simple text editor, but today I switched to NetBeans 🙂
 * So, I am not very good adviser …
 * Ivaylo
 *  [dpt](https://wordpress.org/support/users/dpt/)
 * (@dpt)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422339)
 * Hello, I was having this problem also. It is now successfully posting to the 
   database, but I am not getting the “friendly ‘Options Saved’ message” described
   in the book. Did anyone else?

Viewing 9 replies - 1 through 9 (of 9 total)

 The topic ‘WordPress bible example’ is closed to new replies.

 * 9 replies
 * 3 participants
 * Last reply from: [dpt](https://wordpress.org/support/users/dpt/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/wordpress-bible-example/#post-1422339)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
