1
vote
1answer
34 views

Access Wordpress database outside of Wordpress

MAIN QUESTION: I am writing a wp plugin. Within it, I have a page located here: http://example.com/wordpress/wp-content/plugins/myplugin/page.php How do I access WP database from this page? Is ...
0
votes
0answers
28 views

Run query once inside a loop

I am trying to prevent to much queries inside a plugin one of my plugins. I have a query inside a function which will output a complete block with some layout elements and an input element which will ...
0
votes
1answer
49 views

How to access the WordPress DB from a plugin file

I'm building a basic video management plugin, with an embed feature that will have URLs like: mysite.com/wp-content/plugins/embed-video.php?video=[POST ID] I plan on using the [POST ID] url parameter ...
0
votes
0answers
21 views

Proper way to trigger a MySQL query via link in a plugin

I am trying to develop a module in my WordPress plugin that will delete an entry from the database. The only issue is related to the trigger action. I've tried to send my users directly to the page ...
0
votes
1answer
63 views

get_var result empty for query of custom table in plugin admin

(There are a lot of related questions to this but none I can find with answers that have worked.) get_var returns empty when I query a custom table from a custom plugin for multisite. What am I ...
0
votes
1answer
227 views

How to delete all records from or empty a custom database table?

I can't seem to find a simple reliable way to do this - perhaps?: // delete row ## global $wpdb; $delete = $wpdb->query( $wpdb->prepare( "DELETE * FROM `wp_table_name`" ) ); ...
0
votes
1answer
529 views

WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]

after wordpress update to 3.5+ i get error in this plugin. I do not understand how to fix it. If anyone can help me with these problem or give me an example of how to fix it here is the full code of ...
0
votes
1answer
184 views

after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()

after wordpress update to 3.5+ i get many errors in this plugin. i found that the reason is: http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/ I do not ...
1
vote
1answer
174 views

Correct way to perform non-cacheable DB query

Consider the code function getNow() { global $wpdb; $now = $wpdb->get_var("SELECT NOW()"); $wpdb->flush(); return $now; } I am using the above method to avoid caching ...
0
votes
2answers
133 views

query_post and wpdb returning different results

I am trying to get the woocommerce products by category.. When I query using the wpdb it gets the product correctly which exists in the backend products list. But when I query using the query_posts it ...
0
votes
0answers
130 views

Script timeout when importing/inserting > 45-50 posts from an external table

Wondering if anyone can spot the obvious mistake or give me some guidance on where I'm going wrong. I should also state this is my first plugin with Wordpress, so I'm sure I have overlooked ...
1
vote
2answers
261 views

Inserting large amounts of data into a custom table during plugin install

I am working on a WordPress plugin that creates several new tables into the database. It also loads some default data into the tables from CSV files. Most of these are small and loading the data works ...
0
votes
1answer
850 views

How to insert multiple postmeta values with one query?

I have a custom script/plugin I am using for myself that creates a post along with some postmeta information. Right now, I have multiple $wpdb->insert, but I would like to condense this down into ...
0
votes
1answer
259 views

Stackoverflow type of badge plugin giving warnings in Wordpress 3.5

I modified an abandoned Stackoverflow form of badge plugin to work with Wordpress 3.4.2 and it does indeed. The full script for it is here: http://pastebin.com/Ta91zXiL When upgrading to Wordpress ...
1
vote
1answer
1k views

ob_end_flush error when using wpdb in plugin

I created a small plugin to test database interactions in wordpress. I have a small function that inputs the arguments to the table. If i call my function in a themefile it inputs my test values to ...
1
vote
3answers
549 views

Why am i getting this error? WordPress database error: [Query was empty]

I am using Wordpress 3.4.2, latest version! I have no plugins installed except the one that I am writing. So Here's the deal, I'm reading a json feed and i'm trying to import its content into a ...
-2
votes
1answer
34 views

How to dispaly post informations (such as titles) in an admin plugin menu page?

I'm trying to develop a WP plugin to show post(or page) related information (such as show all post title in a list) in an admin menu page. I tried to use "The Loop", but it seems like "The Loop" ...
1
vote
1answer
479 views

dbDelta only creates the last table

I'm using following install function with dbDelta as referring to the codex, articles on SO I watched out for the typical problems with e.g. one space instead of two spaced at the PRIMARY KEY ... ...
2
votes
0answers
267 views

post_content getting cut off on blank space on $wpdb->update

I am publishing the following post via xmlrpc <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><meta ...
1
vote
2answers
58 views

plugin code is pulling information from database in one instance and not in other. What is wrong?

In my plugin code, I am pulling the table id from two tables. The id is being pulled from one table but not from the other and I get errors in both instances. The queries work on mysql when I use ...
0
votes
1answer
59 views

Linked pages from plugin on front can't see $wpdb

I obviously need more knowledge re this one. From my plugin. I have a custom main page which displays my custom db data table of a list of stores. Each store has a "link" ie using a href eg. <a ...
1
vote
3answers
2k views

Help With MySQL to WPDB Query Conversion

I have a problem. I've got a PHP script that tracks individual file downloads, and I'm looking for a way to display that number in individual posts. I've got a half-baked solution- a plain ol' MySQL ...
0
votes
1answer
341 views

Making plugin to use different table prefix cause permission problem

I have multiple wordpress websites that uses the same files and database but with different table prefixes, I use a plugin "Shortcode Exec PHP" and I would like to use the same shortcodes on all the ...