Make sure you reference the global $wpdb
variable first, otherwise PHP doesn’t know what $wpdb
is or whether or not it has a get_results()
method or a prefix
property.
So just add global $wpdb;
to fix it:
<?php
global $wpdb;
$gallery_ids = $wpdb->get_results(
"SELECT gid FROM ".$wpdb->prefix."ngg_gallery ORDER BY gid ASC", ARRAY_A);
?>
Related Posts:
- How to exclude a widget from page 1 of a paginated post
- Add a plugin before main container
- Modify pages widget and make a plugin?
- Failed to load resource: the server responded with a status of 500 () post.php
- Python in WordPress – A “Hello World” implementation
- How to remove a css class for any wordpress page
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- Display static pages instead of category, in code
- Attachement title in wpallimport
- Should all plugins be encapsulated in a Class?
- Pass PHP variable to javascript
- PHP code on Visual Composer Plugin
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- Trying to disable plugins doens’t work
- Thumb rating for wordpress – top user
- Errors while using ajax from external wordpress page
- Have Plugin Handle Specific URLs
- Setting up widgets in wordpress with a unique ID for the after_title argument
- post expire after x days
- allow arabic letters when register new account
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- How do you remove plugin edit option?
- wordpress reusable content blocks
- Make specific products accessible only to a user role in WooCommerce
- Where should I save an API key of my user when installing my plugin?
- Accessing post’s meta data based on user’s click of a post
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- How to add equivalent of php include to one page (as plugin?)
- Override Plugin Script Fucnction in WordPress
- Shrink down register_settings on Settings API
- Parse error: syntax error, unexpected ‘new’ (T_NEW) in /misc/41/000/204/381/9/user/web/ragami.net/wp-settings.php on line 219
- How to call WordPress function other files
- Removing an action from wp_footer called in a class that’s inside a bigger class
- WordPress plugin/theme or other wayout to create portable pages?
- Ajax call returning 0
- Some code in shortcode function being ignored
- Subdomains with almost the same content
- WordPress page and plugin list using sql query
- Using window.onload with Ubermenu
- What is @Action in WordPress?
- Inserting custom PHP script on homepage
- How to have sample page for each new register users in a membership website
- Add bcc to contact from on wordpress
- Getting taxonomy images to display on single-post with their terms
- wp_enqueue_scripts
- WordPress Console Application (ability to excecute a custom function via crontab only)
- Get all the URLs of the pages that uses a specific shortcode
- Huge number of 404 pages getting spawned
- Pagination shows Same posts
- Theme Functions run a function upon activation or preview
- Adding a pagenavi to function for displaying bookmarks
- eaccelerator PHP error
- Looking for a good way to include php code in posts, but using special include markup rather than direct php code
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- Redirect unloggedin users
- Show prices with tax Inclusive in Minicart widget
- Custom fields not showing up in the user info (PaidMembershipsPro)
- WP Function does not trigger on Webhook API Call
- Remove a div class with condition
- Problem with checked box on wp car manager plugin
- issue concerning ob_end_flush functions.php
- In a plugin, How to update a json file using ajax
- Hooking into the HTML header container
- PHP Error message Upload images to remote server
- No route was found matching the URL and request method
- WP_get_image_editor resizing images in a foreach loop
- my hook or my function wont run in the cronjob
- CMB2 Output Select Box Chosen Option
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- How to echo a PHP Code After the Content
- Woocommerce list variations that are added already to cart in Single Product
- Show custom taxonomy in theme
- WordPress Admin sub-level menu issue
- Passing ajax variable to more than one wordpress plugin function
- Add class as plugin for other plugins
- Social sharing plugin directing to blank page after post sharing
- using href when creating wordpress plugin calls empty page instead of php file
- Hidden Some Setting on Post or Page [duplicate]
- Saving custom form fields
- How to add php stylesheet to admin section instead of admin_head hook
- How to tell which Plugin is displaying?
- Template from scratch: Sidebars not showing widget
- Contact Form 7: custom validation [closed]
- Wp Pagenavi how to display all results
- Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts
- Redirect url in plugin to somewhere else?
- How to add homepage Widget?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- WordPress create permalink structure for custom post type with userid
- Shortcode inside a redirect [closed]
- Block registration with viewScript
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Posts in Admin only display 1 Post instead of all Post in admin area
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Getting 504 Gateway Timeout Error on AWS Server! [closed]
- WordPress issue – data is not showing in wp-admin, but when searching through database, all the data is there
- WordPress Throwing Deprecated Errors on its own Files
- plugin doesn’t retrieve data from database