Why don’t you just do..
add_action( 'wp_head', 'quick_qs_db_css', 100 );
function quick_qs_db_css() { ?>
global $wpdb;
$table_name = $wpdb->prefix . 'qs_css';
$db_css = $wpdb->get_results(
"
SELECT qs_the_css
FROM $table_name
WHERE qs_css_id = 1
"
);
<style type="text/css" id="db-css">
<?php echo $db_css[0]->qs_the_css; //outputs null ?>
</style>
<?php }
Seeing as you are using it everytime head is loaded, it would make more sense than to keep the two separate unless there’s good reason for it?
Related Posts:
- Make a SQL query with wpdb in WordPress
- Pagination with custom SQL query
- How to make an activities stream mixing posts and comments?
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Select from wp_post and multiple meta_value from wp_postmeta
- How to correctly pass values to wpdb->prepare()?
- $wpdb select date range of posts
- How to delete taxonomy term when a wordpress user is removed?
- How to pass orderby params to $wpdb->prepare()?
- List of ways to access WordPress database?
- Passing a SQL query to the WP Query
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Include post_status check within $wpdb query
- wpdb LIKE request shows all database data
- Convert a WP Query into a simpler SQL query to fetch only COUNT of posts
- WP_Query with “post_title LIKE ‘something%'”?
- How to print the excuted sql right after its execution
- Return only Count from a wp_query request?
- Whats the difference between post_limits and pre_get_posts?
- Is it true $wpdb->get_results is faster than WP_Query in most cases?
- Use WP_Query with a custom SQL query
- Order by two meta keys
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- SQL query equivalent to WP User Query
- Function to check if author has posted within the last x days
- Calling a custom excerpt function in a local loop
- Dynamically Override Fancy Title – Part II
- query posts in functions.php and update a field
- Advanced WP Query hogs the SQL server
- SELECT * FROM $wpdb->posts WHERE ID > 160
- Best practice custom function, where to echo the variables?
- How to get user_id from wordpress database inside ajax function?
- Query post with meta_query where date is not in future
- How would I format a query that depends on post parent taxonomy
- How To Fix WP Query Returns Results But Shouldn’t?
- List of the years with posts presented
- Display fields as values in array from external SQL DB
- Optional Meta Query
- Sorting events by descending date, and ascending time if multiple events on a date
- Getting post revision and printing them on the post content site
- Editing the default wordpress search
- Iterating through $wpdb query without using get_results for large query results
- How to filter, restrict and return posts based on custom user meta information
- WP Query using tax_query & meta_query
- How to extract specific post
- Woocommerce – Changing the order of the upsell products [closed]
- How to do set post permalinks using 6 digit random unique function?
- Query with search and subscribers only output
- Changing sort order for presentation by Jetpack infinite scroll
- wp_Qwery works to slow
- Include data from custom table in WP_Query
- How to query custom post types with mixed AND & OR statements for custom fields
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- Query most popular terms by taxonomy over 2 week period
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- how to access query string in wordpress?
- Is it safe to access the underlying mysqli object from \wpdb for custom queries?
- Merge two search functions for custom post type
- Is it possible to query from external database? [duplicate]
- Include post content of linked posts in search
- Specify strict ‘order by’ in WordPress query
- Getting rid of unwanted nonSQL syntax characters when debugging a query
- How I can change the condition or compare operator for WP_Query in pre_get_posts
- Does WordPress have something like Drupal’s DB API?
- Exclude authors IDs from WP_Query
- Query where ANDing slug values not working
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- How do I fit WP_Query arguments into a function?
- Add URL Rewrite Rule To WordPress
- WordPress dynamic AJAX query
- relation OR instead of AND – Filtered term ID’s in loop
- get_var is neither a string, integer, or array …?
- What’s wrong with this wpdb query?
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- SQL query injection with fifu image
- Save queried result into database
- WP Query – grouping posts by same meta key, adding together values from another key
- Custom query for custom post type not getting correct post ID
- Translating WP query into to SQL query
- how to move a page from one drop down menu to another drop down menu
- Filtering posts for unique titles, only the most recent
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- How to search CPTs in draft using get_page_by_title()
- WP_Query & shortcode : Return 3 articles from a category WordPress
- Seach and categories not working when ignoring sticky posts in main loop
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Declare inline background image in functions.php
- ordering and optimizing functions
- Fire query on ajax post url page
- Custom WP_Query with SQL directives for getting posts by authors and terms
- How to return value from sql and display it
- orderby in WP_query doesn’t works
- Query is not work
- Different sql queries count indicator on the main page [closed]
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- How to write a query-function as a query-shortcode?
- 1500+ duplicate queries via get_option function (query monitor)
- Add custom argument to WP_Query and modify SQL where clause
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- Is there another way to retrieve a post_id from post_meta other than a SQL query?