That’s not how register_activation_hook
works.
register_activation_hook
is called only once, when the plugin is activated. CPT’s however need to be registered on every single request, not just when the plugin is activated.
This is because WP doesn’t store a list of CPT’s in the database, it’s generated at runtime by PHP code.
So instead, register your CPT’s on the init
hook. The same for custom taxonomies.
As for the activation hook, use that to create custom database tables if needed, but the activation hook isn’t super reliable to begin with. Most plugins don’t use it.
Related Posts:
- Built a second plugin but it overwrote the first one
- WordPress plugin blog creation
- Get post content inside plugin class method
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Function not being called on form submit, only blank admin-post.php page
- Check if variable is set in filter
- How to add apply_filter for a class property in plugin
- Issue running db create table query from static method
- execute function after one completed
- How to make multiple admin pages for one plugin?
- Include a php file from another plugin
- Integrating boxtal PHP library into a custom WordPress Plugin
- How to redirect to same page after form submission
- A server-side hook failed when committing plugin code to SVN
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- How do I add $_SESSION[”] to my wordpress page?
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Plugin onclick button activate other plugin
- get_option / wp_localize_script Not Working in OOP Plug In
- I receive taxonomy id
- output html on post or page from custom plugin [closed]
- Loop in elementor custom widget not working
- How to create plugin/ page that reads from database
- Save user total active time after login in wordpress [closed]
- Creating a functionality plugin to edit seriously simple podcasting
- How WordPress core manage the plugin installation
- Switch from wp-cron to a server cron job
- Asynchronous request in wordpress
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Make plugin php file called directly aware of WordPress?
- Why is it important to check for isset and is_array before checking in_array in this example?
- How to add/change (woocommerce) product tab icon
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- I want to generate the pdf and save it in library?
- WordPress Object Oriented plugin development [closed]
- How to access OOP plugin function inside themes or other plugin
- Way to send multiple values for column to MySQL?
- Using meta_query in a WP_Query not working for numbers properly
- Calling a save function from a “submit” button
- Wp Debug Enabled True Notices and Warning
- How to call external functions from a PHP script in a WordPress plugin?
- How to write to a separate PHP file in plugin settings
- Create “new pages” within the admin section of plugin
- Next Previous Post in wordpress with previous / next link with title?
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- Apply html elements in php statement
- How to display results from a data table with an encrypted user id?
- How to add custom function to pluggable.php
- WordPress Post HTML after Posting
- Settings options not showing up on Sub Menu page in WordPress plugin
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- can’t unzip file
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- How to Add text value in Automatically in this conditions?
- Checkbox show / hide output result
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- save_post_product action not firing
- Conditional delete metadata does not works
- How to get the custom field value using SQL query
- Unexpected add action function in WP plugin
- WordPress Custom Hook with Class method
- How to create admin setting for this small plugin
- Allow a particular user to access a particular plugin?
- admin_notices show after load completed
- Prevent WordPress from sending set-cookie http header
- Cookie value changes back to previous value after changing
- Change plugin descriptions
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- How use wp_insert_post and add og:custom tags?
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- The Build menu theme is frozen with the wordpress theme
- Problem with checked box on wp car manager plugin
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- How can I translate something in my class constructor of my plugin in WordPress?
- Define global variable in theme file and call that variable in plugin file
- Why is my shortcode not working?
- WordPress rewrite rule depend on meta values not ids
- Rename a folder via HTML POST request
- How to change “Read More” text?
- How to translate to spanish wordpress hardcoded content/files?
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- update_post_meta is not working for me when I use e.preventDefault for update button
- How can I see $post object in frontend from functions.php?
- Move plugin pages from dashboard to front-end
- working code, not working – Plugin Dev
- SimpleXML is not working with xml response from external api
- How to use Datatable with Ajax when creating plugin on WordPress?
- Problem with wordpress has_action() function
- Offering a freemium plugin (a free version + paid version)
- Using id to show item
- Multiple image selection custom widget
- implement checkbox or toggle switch in plugin code
- 500 Internal server error wp_handle_upload_prefilter
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- Change Woo Custom Endpoint Titles from a Plugin
- Create a form and have custom menu display based on user answers?