Call to undefined function `get_plugin_data()`

I have a class inside a file that i include_once() from the functions.php of my theme. The class can be used as stand alone plugin, or integrated in a theme. Inside the class i want to fill a class variable (inside the __construct() function) with the native wordpress function get_plugin_data(). Fun as it is, i get the following error: Call to undefined function get_plugin_data() Am I asking for the plugin data too late, or what else might be my problem? …
Category: Web

Is it save to require plugin.php early to be able to use get_plugin_data() earlier?

I'd like to avoid hard coding my plugin's version at multiple places. To realize this the function get_plugin_data() comes in handy. But here the fun comes to an unpleasant stop. Checking for a plugin update to execute related housekeeping for example should be done early (e.g. plugins_loaded) but unfortunately wp-admin/includes/plugin.php is not loaded before admin_init is fired. Using a later hook is not possible here. This might be a solution for some plugins but it doesn't work for me, as …
Category: Web

Plugins or Tutorials for displaying data from SQL-db on WP-page?

I have a custom weather-station on a Raspberry Pi 3 with a local LAMP-setup running. The sensordata is stored in it's own database. The job for Wordpress is just to have a easy (somewhat) WYSIWYG-possibility to edit the design of the display-page that is shown on a secondary Pi by using a fullscreen-browser. I need now 3 somewhat "unique" functions that I couldn't find a proper solution for: Shortcodes for the latest (real-time) data-entry of the database (like temp, humidity, …
Category: Web

Suggestions on Approach to New Plugin I'm Stuck On

I'm a newbie plugin developer, and I've had an idea for what I though would be a simple to build debut plugin, but I seem to have reached a brick wall with it and wonder if anyone can suggest some alternative approaches or even tell me whether it's even possible. The aim of the plugin was this: to create tool tips showing the plugin name, for any menu items in the Admin pages that were created by plugins (i.e. not …
Category: Web

Retrieve data from multiple Wordpress sites using PHP script

I want to run a PHP script that iterates over WordPress sites found in a certain folder and read the plugins info per each site using get_plugin function In the code below, I try to require API functions inside the WP folder and use it to retrieve data. However, the problem is the multiple "require". Sample code: function get_sites_plugins() { foreach($this->all_sites as $site_folder) { $plugins = get_site_plugins($site_folder); echo "Info for site $site_folder"; var_dump($plugins); } } function get_site_plugins($site_folder) { // define …
Category: Web

Unable to retrieve data from multiple Wordpress websites on same server

I am trying to retrieve data from multiple client Wordpress websites on a single php page. So I can monitor all these websites without going through each one. I am able to display data from one single website. Like this, I am listing all plugin installed on one Wordpress. <?php require( './domain1/wp-blog-header.php' ); if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); echo '<h1> ' . get_bloginfo( 'name' ) . '</h1>'; foreach ( …
Category: Web

Get file headers in custom file

in my one of my plugins i have modules (kind of like plugins in a plugin), is there a function like get_plugin_data() or wp_get_theme() that will allow me to get the header section of a custom file (by passing the path as a parameter)? By heading section i mean /* Plugin Name: Name Of The Plugin Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates Description: A brief description of the Plugin. Version: The Plugin's Version Number, e.g.: 1.0 Author: Name Of The Plugin Author Author …
Category: Web

WordPress Multisite - get_plugin_data()

I use WordPress Multisite. I have multiple sites with plugins installed. I can successfully get a list of the plugin paths with the option value active_plugins from each site. I can not get additional data from get_plugin data. I use this code: $plugins = get_blog_option($blog_id, 'active_plugins'); foreach( $plugins as $plugin ) { var_dump( get_plugin_data($plugin) ); } The error message: "Warning: fopen(akismet/akismet.php) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\blogs\multisite\wp-includes\functions.php on line 3493" If this is not …
Category: Web

"Master" Wordpress Multisite - Database Sync

I've had an idea in my head about creating a Wordpress Multisite environment that would have Plugins along with them that would not only have "default" settings, but be able to update each blog's plugin options based on a "master" site. That way, instead of having to change settings through every site - you'd be able to just change it in one spot. Now I've seen http://snippets.davejamesmiller.com/code/php/wordpress/automatically-enable-plugins-in-new-wordpress-multisite-blogs which can handle activating and setting specific plugin settings - but this wouldn't …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.