You’ll have to use get- and add_option inside a register_activation_hook.
<?php
register_activation_hook(__FILE__,'save_activation_timestamp');
function save_activation_timestamp()
{
add_option("myplugin_activation_timestamp",mktime());
}
?>
You can find an entire tutorial on that at CodeYoghurt.
It even mentions your case as an example.
Related Posts:
- Update File Once Every 30 Days
- What do you think about custom designed plugin/theme options UIs?
- Is it necessary to bump a plug-in’s version if you’re just updating the “Tested up to” attribute?
- Adding Widget form fields dynamically
- Custom action button in Gutenberg editor (post_submitbox_misc_actions – equivalent)
- add_action with a class method is causing fatal errors
- Include third party Javascript library which is not included in WordPress
- Update a Plugin while maintaining back compatibility: general
- Do I need to use WP_Filesystem when creating a downloadable file on the fly?
- How to get vim to autocomplete WordPress API functions?
- Not sure the best way to save custom plugin data
- Plugin development with unit tests
- Change WordPress.org hosted plugin readme.txt
- What is a settings group actually for?
- How does gettext works for translating readme file of plugin?
- How to debug WordPress correctly?
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- Problem with `wp_mail()`
- How to add meta boxes to the ‘Add new post’ screen?
- Cannot modify header information – headers already sent by pluggable.php
- htmlentities and editing text
- Gutenberg registerFormatType with Multiple Classes
- Translate strings not recognised in plugin
- Print WordPress username id inside JavaScript
- How to Download and install plugin database remotely
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- WordPress add_admin_page not working even parameters are correct?
- How to use WP_Term with (menu) argument in the wp_nav_menu?
- Any problem in using native jquery ajax style instead of using admin-ajax.php?
- Communicate between plugins
- When to use add_settings_section vs just register_setting?
- WP_Editor – Saving Value into Plugin Option – Stripping HTML
- Admin Plugin POST to another file within the plugin
- user_register not triggering with email verification
- How to get boolean value from register_meta properly?
- Why is the WordPress taxonomy not registering?
- Gravity Forms Perks – Nested Forms
- Checking for existence of a page by title?
- pagination in a custom list created with get_pages function
- How can I identify it as admin page or not?
- AJAX form post returns 0
- Adding admin menus to wordpress
- Update custom plugin with WP-CLI
- Autogenerate a Table of Contents
- Why enqueue styles on hook?
- Fatal error: Cannot redeclare admin_notice() [closed]
- Update wordpress Core Remotely
- Proper way to use useSelect
- Access to apache logs from plugin
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- Translating plugin settings page – dropdown list
- modify show UI of a registered taxonomy
- Using function from enqueued .js file in theme in plugin?
- how to save wp_editor html content in options table
- Hide one specific woocoomerce product
- settings api – add_settings_section not working
- get_shipping_methods() return empty rate
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Unable to access custom plugin backend
- Resize not resizing images with Capitial extension like JPG
- Redirect returning users to a certain page?
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- Can I use a custom post type as a custom taxonomy for a different custom post type?
- wp_schedule_single_event is set correctly but sometimes not fired
- WP_List_Table Inside Metabox With Bulk Actions Not Working on Submit
- Attaching Image-file to userId
- wp.media gallery collection sometimes undefined
- WooCommerce maintaince mode by using php
- Rerender core Templates with with ToggleControl but it doesnt recognize block type
- Can’t load a script in my plugin page
- WordPress shortcode with a switch
- Add New Button in Admin Panel
- ajax call return 406 not acceptable for non logged users only
- $ is not defined [duplicate]
- Counter not working correctly
- Inserted data from database does not showing on front-page without referesh page?
- Remove tag from all posts when publishing new post
- wp_editor embed shortcode not working within my plugin
- How To do Ajax In WordPress Custom Plugin?
- replacing jquery google cdn with a new version dynamically
- Dynamically getting tags in post edit screen
- How do WordPress plugins work with oAuth2 APIs?
- Moving the “share” button
- WordPress mails being sent from @locahost and being rejected
- How to implement pagination into a wpdb->result query?
- Ajax not working to insert, query and result data
- wordpress plugin require_once file – can’t user wordpress functions
- Change Page title when Pagingation the posts
- Custom MySQL query to pull out Advanced Custom Fields?
- Slug is not shown for my custom post type
- wp_register_sidebar_widget in loop within a plugin?
- Remove image in post when it’s removed in media library
- Get next page in get_posts
- How to Implement SAM Broadcaster with WordPress? [closed]
- Fatal Error triggers Before WP_Error handler
- How to create wordpress plugin support page? [closed]
- Add custom data-attribute to core Gutenberg block within an template
- Why is WordPress wrapping search for users that looks like integers with asterisks and how do I fix it?
- wp cron does not run when i am not logged in to wp admin
- update_option with array_push adding mutiple copies