Wrap your function with !function_exists()
to avoid a redeclare error.
if( ! function_exists('FAvideoid') ) :
function FAvideoid()
{
return $wpdb->get_var( "SELECT 'video_id' FROM $wpdb->ytvideos ORDER BY RAND() LIMIT 1;");
}
endif;
Or to reduce the code from being imported more than once:
include_once "FA-db.php";
include_once "FA-admin.php";
include_once "FA-ad.php";
But probably the best route is to mix the two:
// Only load files and hook events if your functions haven't been defined
if( ! function_exists('FAvideoid') ) :
include_once "FA-db.php";
include_once "FA-admin.php";
include_once "FA-ad.php";
add_action( 'admin_menu', 'FAmenu' );
add_action( 'wp', 'FAad' );
add_action( 'activated_plugin', 'FAsetup' );
endif;
Related Posts:
- Activate a plugin through PHPMyAdmin or FTP?
- How to delete all records from or empty a custom database table?
- dbDelta only creates the last table
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- WordPress plugin installation error
- WordPress error – PHP Fatal error: Uncaught Error: Call to undefined function register_block_type_from_metadata()
- Stackoverflow type of badge plugin giving warnings in WordPress 3.5
- Missing argument 2 for wpdb::prepare() Issue
- ob_end_flush error when using wpdb in plugin
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- post_content getting cut off on blank space on $wpdb->update
- Can’t access my WP dashboard: fatal error? [closed]
- Using plugin functionality in external php script not working
- Multiple files in a plugin
- Can I delete plugin files using FTP?
- Why am i getting this error? WordPress database error: [Query was empty]
- Inserting large amounts of data into a custom table during plugin install
- plugin ajax to external php file always return null
- Elementor\Scheme_Typography’ not found [closed]
- When to call add_filter
- Doubt using $wpbd->get_col for a single column
- Access WordPress database outside of WordPress
- Correct way to perform non-cacheable DB query
- WordPress Blank Screen Issue [closed]
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- Problem with creating tables for Plugin
- Change commission_status paid when withdraw_status vendor is completed
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Why “Call to a member function on a non-object” in plugin only?
- $wpdb->get_row returns column name instead of column value
- Create a table with wordpress plugin boilerplate
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- Fatal error can’t activate a plugin [closed]
- Object method calling for global $wpdb in header.php
- Using wpdb without loading all plug-ins via wp-load.php
- Cannot access my wp-admin after installing Gzip compression [closed]
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- How to insert multiple postmeta values with one query?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- WPDB: Update table
- Issue running db create table query from static method
- Invalid plugin installation directory, Google Analytics [closed]
- $wpdb update query in plugin only updating one column
- How to prevent PHP fatal error if plugin hasn’t been enabled and a method is called in theme file?
- Fatal error on some pages after cancelling WPSTAGING cloning process
- There has been a critical error on your website – won’t fix no matter what
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- Error with get_price (and others) in self-written plugin to show price
- Mowing site to another domain in simplest way
- Store plugin page content in wp_options?
- Displaying data from another database
- Using $wpdb in a plugin, what sort of data does it return?
- How to access the WordPress DB from a plugin file
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- After a manual update, themes and plugins that were installed (and still in the directory) are not being seen
- Linked pages from plugin on front can’t see $wpdb
- Need help creating asynchronous data scraper in WordPress
- Manualy Updated WordPress Error
- ob_end_flush(): failed to send buffer of zlib output compression (0) in external php
- Replace old theme that understand old css (vcex_icon_box css_animation)
- How to fetch WordPress database values in JavaScript widget
- $wpdb->delete not working for me
- any word search WordPress
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- How to securely controlling data without keeping it in postmeta?
- Using id to show item
- Fatal error: Class ‘RDTheme’ not found
- No result after wpdb->insert
- How to fix slow comment query?
- Making a Custom Post Type Plugin – keep getting the white screen of death
- Call to a member function get_error_messages() on null [closed]
- Write mysql credentials in plugin
- Fatal error when accessing Pages in WP admin (and problems editing any pages)
- Action hook “wp_insert_post” works but not for last imported post
- Proper way to trigger a MySQL query via link in a plugin
- Plugin Breaking WordPress Login
- get_var result empty for query of custom table in plugin admin
- Fatal error with jigoshop and woocommerce
- Plugin won’t activate, fatal error (widget class not found)
- Making plugin to use different table prefix cause permission problem
- How to fix ‘Call to undefined function do_settings()’ error?
- Is it safe to increase/alter the size of the wp_post.guid column from VARCHAR(255) to VARCHAR(2048)?
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Get all the related data from WordPress DB
- White Screen When Includding A Folder With PHP Files
- $wpdb selects wrong database
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- Unable to access WPadmin, website down
- WP Elementor Pro causing crtical failure on website
- fatal erro in one line if statment in wordpress plugin [Solved]
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- What characters are allowed as a shortcode tag and how should they be sanitized?
- disable active plugins for specific theme
- Flickr plugin that will display photos from multiple group pools? [closed]
- Add a CSS class based on categroy id to archive pages
- Creating plugin for changing slug
- change output location of plugin function using a custom hook
- Issues with Post 2 Post Plugin