This works if add this code in functions.php
?
if ( ! function_exists( 'test_setup' ) ) :
function test_setup() {
$ar = array(
'price_content' => 'hello'
);
$result = $wpdb->insert('hs_prices', $ar); // insert 'hello' into 'price_content'
}
add_action( 'after_setup_theme', 'test_setup' );
Related Posts:
- How to deploy a new theme/theme options from staging to production site
- Merging PHP download script into `functions.php`
- Change setting name in Customizer and keep the data
- For best DB performance should I serialize all theme options together or by type?
- Users table association with users_metadata table appears broken
- How to change database values on theme update
- How can I make my options in an array and store theme in WP options one DB row?
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Efficiency of wp_options vs a new table
- Database Tables in WordPress Theme
- How to transfer one domain to another domain without losing theme options (customizer)?
- Valid SQL query not returning results
- Clearing dummy data before launch
- How to get DB options format without saving? [closed]
- How to use multiple check-box values to work in a function and insert values in database
- Duplicate child theme incl. design changes
- Query wp_postmeta into an array based on post_id
- How does offset works on pagination? (get_results)
- Workflow of Collaboration on wordpress development [closed]
- Website Developer has gone missing! How to gain full access of your code from a WordPress website?
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- Bestway To Define Theme and Plugin path and url
- Form to Add Posts to Custom Post Type
- How do I add settings to the Background Options Page?
- What is the right way to include a wp-admin file in your theme?
- WordPress twentytwenty theme inline css overriding css body
- What is the problem if I use CDN in my WordPress parent theme(built using bootstrap)?
- Active theme responds to theme change request to alert user
- LOST in WP Template Hireachy
- Theme showing incorrect update
- modify a output of a widget
- Enabling Default Widgets in a Custom Theme
- changing Specific section background image in wordpress
- There’s an image named g.gif somewhere in my WordPress site
- How to highlight the current page in the nav menu?
- customizing the_password_form filter
- Whats the safest way to output custom JavaScript and Css code entered by the admin in the Theme Settings?
- Should I use language_attributes() or bloginfo(“language”) in html tag
- How to upload images using Settings API
- WordPress 404 page returning with default in IIS7
- searchform.php override not working
- Load child template based on parent
- How to make the_tags title translatable?
- Should I use include or load_template for including shortcodes, plugins and so on?
- Get a setting value conditionally in the Customizer api
- Set default featured image for terms of a custom taxonomy
- How would you accomplish the following advanced settings page?
- image url relative path not working in css file
- Timber: Get single image from media library with all attributes
- page.php dependent sites are not working in custom woocommerce theme
- How WordPress reacts to a lack of memory of the server [closed]
- Sort wp_query by sum of two meta fields
- How to i style the elements from the TinyMCE
- Why wp_nav_menu() doesnt show the proper meny when invoked two consecutive times?
- Change the “Default Avatar” admin option via functions.php
- $wpdb error (Call to a member function insert() on a non-object)
- ACF Pro make URL Linked in Custom Template [closed]
- Can’t use admin_enqueue_scripts or wp_enqueue_script
- How is the `get_sidebar` function meant to be used to call a 2nd sidebar?
- Is WordPress a good option for this…?
- What happens if a theme is no longer supported?
- How to find and remove unnecessary theme scripts? [closed]
- Theme logo metadata into template file
- Is There A WordPress Hook for Accessing Attachments for A Particular Page?
- WP Customazation API doesn’t save the default Value
- How to Emulate Default Navigation Menu Behaviour in a Custom Theme?
- Sample Theme Options page for Multisite – what to consider
- How to use shortcode inside of shortcode in theme
- Search Form Not Working
- My contact form – I’ve changed the source code but the changes are not being applied
- Why do sticky posts show in this menu?
- Dot “.” in option value foobars save options function
- Strict Folder and File Permissions for WordPress Themes Folder
- Insert NULL value using prepare()
- WP Gutenberg custom block – generate theme colors from SASS and use them in the inspector and php callback
- How to properly use AWS SES for a contact form?
- Default customizer colors aren’t displayed outside of the preview
- Use instead of for wp_nav_menu()
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- $wpdb->insert duplicating rows
- fetch all post from wp multisite network and sort all the post in descending order on the basis of “Created by ” term
- More HTML elements variety in visual editor
- How allow users to select the theme color?
- How to generate a rtl.css file for themes?
- How can i create my Onepage smoothscrool WordPress theme?
- What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]
- hide/show a div in wordpress
- Add a customize control depending wich radio setting is checked
- How to add script properly for certain post?
- How do child themes work?
- Why WordPress gets old templates code instead of the last updated ones
- Mutlisite in wordpress is not working
- Main Menu Theme Different Output Print
- How to reuse parts of WordPress site e.g. header, footer, part of header for multiple WordPress sites?
- WordPress loop not working on blog.php page
- Option to show/hide widget depending on is_home?
- IS there any reason not to include javascript in my own post’s embeds?
- How to create more templates to the same theme?
- How do I middle-align my header menu items in WordPress [closed]
- How to add Dummy content when active wordpress theme without xml import?