Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:13:47+00:00 2026-06-14T09:13:47+00:00

WordPress version 3.4.2 Here is the simplest form of plugin with only two hooks:

  • 0

WordPress version 3.4.2

Here is the simplest form of plugin with only two hooks:

register_activation_hook(__FILE__, sbv_activate());
register_deactivation_hook(__FILE__, sbv_deactivate());

function sbv_activate() {
  add_option('sbv_opt1', 'test');
}

function sbv_deactivate() {
  delete_option('sbv_opt1');
}

I went to check the option table after I activate this plugin, seems like the option is not there, if I remove the delete_option() line from the deactivation function, it will work. Correct me if I am wrong, seems like wordpress is calling sbv_activate() then sbv_deactivate(), thus undoing what I have done in activation, I don’t think it should behave like this. I am going crazy with this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:13:48+00:00Added an answer on June 14, 2026 at 9:13 am

    You should be using only the name of the function not the function itself:

    register_activation_hook(__FILE__, 'sbv_activate');
    register_deactivation_hook(__FILE__, 'sbv_deactivate');
    

    WP Codex reference: http://codex.wordpress.org/Function_Reference/register_activation_hook

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed the latest version of Wordpress and added the WP-Syntax plugin (and also
1. PHP function. I've created validating function, here it is in shorter version: function
thanks for reading! Here's what I'm up to. I'm writing a WordPress plugin that
I need to create a WordPress plugin that calls a PHP function when a
(wordpress version 3.4) Ok, Here’s what I’m trying to do: Create a page called
I saw these codes from here: http://learnr.wordpress.com/2009/08/10/ggplot2-version-of-figures-in-lattice-multivariate-data-visualization-with-r-part-9/ hc1 <- hclust(dist(USArrests, method = canberra)) hc1
I'm trying to design a theme on WordPress (version 3.3.2) but I am having
First off, let me define the end goal: I'd like to Wordpress (version 2.8)
I am using wordpress latest version. Currently my blog is set to custom permalink
Hi I am running WordPress latest version with a custom coded jQuery featured post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.