Yes, you can store your data in your own tables in WordPress database. There are few things that you need to take care of:
- Make sure your data can’t be really represented using the built-in WordPress content types.
- Prefix your tables with WordPress Prefix + your prefix. WordPress table prefix is $wpdb->prefix.
- Use the global $wpdb to query your custom tables, don’t make a new connection.
Now to answer your questions:
- Yes, it is okay to store data in custom database tables. It won’t conflict if you prefix your table names.
-
There are many places to put your PHP code. But don’t put your PHP code in the HTML editor.
i) You can create your own plugin and for that you can put the code in plugin file which can be stored in wp-content/plugins/ directory.
ii) You can write your code in your theme’s functions.php file.
-
You don’t need a plugin to query tables in WordPress. Just read about $wpdb.
Related Posts:
- Rename a table in MySQL
- How should I tackle –secure-file-priv in MySQL?
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- phpMyAdmin – Error > Incorrect format parameter?
- MySQL Database User: Which Privileges are needed?
- Why is my database import losing text widget data?
- Will it break my site if I delete all transient records in wp_options table?
- Checking if Database Table exists
- Please explain how WordPress works with MySQL character set and collation at a low level
- How to fetch Data in WordPress using MySQLi or $wpdb
- Connect to database using wordpress wp-config file
- Reset Post IDs to less than 64bit integer
- How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?
- WordPress database scalability from the code perspective
- How to define composite keys with dbDelta()
- Is it possible to define two databases for one installation?
- Does WordPress use the InnoDB engine for MySQL by default?
- Can I use MariaDB instead of MySQL in wordpress?
- What are conventions about the schema of the $table_prefix
- Split WP install between 2 databases?
- Inserting Post Meta From SQL
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- Why does dbDelta() not catch MysqlErrors?
- Is deleting orphaned wp_options entries safe?
- Is altering a default WordPress database table update safe?
- How to solve slow WordPress site caused by attachment_metadata
- Huge wp_options table
- Delete all post meta except featured image
- Custom DB_COLLATE (collation) value not working on fresh install?
- What causes the “max_user_connections” warning on WordPress frontend?
- what to do when your WordPress database is too large?
- Change all http to https in mysql databse?
- Large database causes slow load
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Database slowdown after update to 3.4.1
- WordPress and automated MySQL backups to a different host
- How to insert data into MySQL database from the form created in WordPress site
- Size article thumbnails and retrieve them directly from database
- WordPress site uses MyISAM, should I switch to InnoDB necessary?
- Emojis getting converted to “?”
- Which is more efficient? Using usermeta, or creating a new MySQL table?
- WordPress mysql table double prefixes
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- WordPress database import: Row size too large
- Advanced SELECT query with condtional statements
- Why do mass updates to post_content shows in front end, but not in edit screen?
- Error establishing database connection – high traffic?
- Handling large N data in WordPress
- Improve performance by removing unnecessary database queries
- Redirecting to old domain after migration website
- A MySQL DB within a MySQL DB
- Switching Databases in LocalHost
- Create table from array with prepare
- Is there a way to recover the table wp_term_relationships?
- Trouble Migrating all data blog from WordPress.com to WordPress.org
- Unable to set a default serialized array using dbdelta()
- How to prevent/delay MySQL connections when an object cache is used?
- Error establishing a database connection,
- Can’t update WordFence Options, clear data manually
- Changing between Local Host DB to Production DB and in reverse
- How and where is wordpress adding mySQL content to database?
- Why does changing Database Table Prefixes result in loss of content?
- Query Column of Specific ID from Database Table
- How to create more than one new wpdb object?
- Moving WordPress site to new domain – database import [duplicate]
- How to connect and insert data in database of wordpress?
- Buddypress avatar image in database [closed]
- $wpdb->get_var – What value is returned when zero records are found?
- Remote database -> massive response time increase?
- Installing local to live WP into subdirectory
- Getting “Error Establishing a Database Connection” on localhost in new Mac OSX Lion environment
- Cloning blog to localhost via WAMP
- Only allow user to access a link once a year, based on their joining date
- Counting post and changing roles in mysql database. Query not code
- MSQL database wp_postmeta has meta key tve_revision
- I imported an restore an database and It shows #1067 – Invalid default value for ‘user_registered’
- How to edit custom table data in frontend
- local wordpress broke after changing URL
- “BS_” rows in postmeta table
- How can I find user role in Mysql?
- Exporting Post ID, Post Title, Primary Category and Primary Category ID
- Featured image from custom to WordPress database
- WordPress Database Query works in phpMyAdmin but not in the code
- How to create index (sql) to a meta_key?
- Delete all users meta that named: user_avatar
- WPCLI search and replace in a particlar site dir effect another site-dir
- mySQL database size large, but tables size less
- spambot registering without providing email or password, bypassing registration process
- After renaming MySQL database, I can no longer access my Blog page
- How To connect to the same WordPress database with different database user
- Possible to restore wordpress database from mysql56 and sqlite files?
- Hang Up Followed By Can’t select database
- Create a new table on the database and save parameters from a contact form
- Why is converting my database to UTF-8 truncating entries?
- How to back-up a database on IIS
- export individual posts to text files or a single csv file
- Importing Concrete5 content to WordPress
- why you don’t Implement PDO for access every thing to database
- WordPress database connection failed, while mysql client is working [closed]