Works perfectly when this code is in main plugin file:
<?php
function createTable(){
global $wpdb;
$query = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix ."UsersExtra (
user_id INT NOT NULL,
first_name VARCHAR(25) NOT NULL,
last_name VARCHAR(25) NOT NULL,
address VARCHAR(80) NOT NULL,
city VARCHAR(30) NOT NULL,
province CHAR(2) NOT NULL,
postcode CHAR(7) NOT NULL,
interests TEXT NULL,
bio TEXT NULL,
signature TEXT NULL,
skills TEXT NULL,
PRIMARY KEY (user_id),
FULLTEXT KEY (interests, skills)
) ENGINE=MyISAM DEFAULT CHARSET=utf8";
$wpdb->query($query);
}
register_activation_hook(__FILE__, 'createTable');
Related Posts:
- Which hook should be used to add an action containing a redirect?
- Is it worth checking if class_exists when developing a plugin and how to do it?
- Default table collation on plugin activation?
- the_content after all shortcodes are parsed
- How to auto-upgrade my plugin?
- How do I resolve Notice: Undefined offset: 0 in /wp-includes/capabilities.php on line 1145
- Category listing with thumbnail and description on home page
- Hook event for upload image in the menu
- Plugin: Relative URL to images in another folder accessed inside a JS file
- Making a custom widget that includes a tinymce and works in Site Origin Page Builder
- How to use mysql IN statement with wpdb update method?
- Bridge WordPress Media API with custom tinyMCE plugin [closed]
- Creating a path in a plugin to call a function
- What’s the better way to add an inline script?
- Comment `Reply` link doesn’t work if comments are loaded from ajax
- Adding JS function as third parameter in do_action
- Plugin Uninstall and Deactivate via Options Menu
- Do I have to override the wp_mail() pluggable function with writing a plugin?
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- If a function requires add_action(‘init’) how can I run it only once on plugin activation?
- Ordering posts by metadata
- is_page() function doesnt working
- Order properties should not be accessed directly
- How to avoid loading same script twice?
- Is there any way to check for user login and send him to login?
- Where to store the name of a custom table?
- Backbone event attachment:compat:ready can’t hook
- Add a class to a dynamic sidebar’s wrapper
- Limit role to one plugin [duplicate]
- How to fix Uninitialized string offset: error on a checkbox in WP Settings API
- Upgrade private plugin without deleting files?
- Saving value of a selection option in comment form as comment meta
- Is there some way to provide the user a list of existing content in a CPT
- Issue with querying
- how to search users by ajax live search
- Is this best practice for Dynamically adding items to WordPress menus?
- There is a problem in the gutenberg block I developed. Problem is with withInstanceId
- Detect front-end pages only in init hook
- best way to make a WordPresss multisite that is secure but at the same time supporting my plugin development efforts
- How to change title tag at page after loaded post?
- How to get post content by get_posts function?
- Getting following web services error after activating the Rewards Plugin
- WordPress custom taxonomy check box to dropdown
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- How to remove plugin-specific custom taxonomy terms when plugin is uninstalled?
- How to modify files inside wp-includes directory in wordpress
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- Naming conventions when using (PHP5) namespaces?
- add_submenu_page hooked function must explicitly check user capabilities – why?
- How to apply style_loader_src filter with exclusion of a specific file?
- Which is the better way to store images for the plugin?
- Issue on Checkbox with Custom Option Page
- Minimum Widget Width for Plugin Development
- Should I use wp-content/cache or [PLUGIN_DIR]/cache?
- configuration of .htaccess for add_rewrite_rule to make sense
- Restrict certain actions to plugin-specific admin menu pages only
- How to get post meta in functions?
- Adding tables to dashboard pages programmatically?
- Plugin access to average users not only admin
- how to add custom fields into new & update post page?
- List all user post API endpoint
- Rewrite not working since upgrade to 5.9
- Condition to check previous next article post title
- How to display plugin with javascript using markup of the theme?
- Can display plugin without shortcode?
- ACF Field value in wordpress login message filter
- Hook for validating and rejecting frontend image upload
- Plugin removes itself if mistake made during edit
- Using meta_key & meta_value in add_rewrite_rule
- Multisite and the JSON REST API: How to?
- Can’t create a blank template
- Custom Registration Form and Passwords
- Looping single post in a theme
- WP Ajax on page load not working on bluehost but was working on Godaddy
- Fullwidth slider using background image Flexslider WordPress
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Plugin files not updated (cache cleared)
- How to create an embedded code for wordpress shortcode?
- How can I send an id over the url?
- Creating custom Insert Media page
- Get fields of a widget
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- Initialize class inside plugin
- How can i call from custom fields to the category editor?
- How do you filter get_media_items by mime type in a custom media upload tab?
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- Which subset of html does WordPress support?
- Trying to build a plugin – Cannot modify header information
- Build a dynamic block using the default attributes
- How to display .ptm file in my WP site without JAVA
- Bulk post approval and publishing doesn’t work
- Show Admin Menu
- How to replace content of a block in and re-render on change?
- extending a core block doesn’t work inside the editor
- register_activation_hook doesn’t execute without add_action(‘init’,’some-function’)
- Getting similar posts by custom field value
- Does WP REST API cache internally executed (rest_do_request) requests?
- Trouble Importing whatsapp-web.js in a WordPress Plugin Development
- ‘useSate’ error when using React on the frontend in custom block plugin