How to get home page ID?
$pageID = get_option(‘page_on_front’); should get you the Page ID of the page set at ‘Front Page’ in WordPress options.
$pageID = get_option(‘page_on_front’); should get you the Page ID of the page set at ‘Front Page’ in WordPress options.
If you can stick to overriding just functions that are located in wp-includes/pluggable.php then you should be able to avoid any kind of plugin conflicts … unless you are using plugins that are overriding the same pluggable functions. Just make sure that your functions are declared before pluggables is loaded. Plugins are loaded before the … Read more
is_plugin_active() is rather fragile: it will break when either the plugin author renames the main file or when the user renames the plugin’s directory or main file. It’s better to check if a certain public function exists. To avoid having to make that check each time you need some of the plugin’s functionality, you could … Read more
That’s the total number of downloads. It includes direct downloads in the Repository and installs/updates done in the dashboard. Quotes from Otto comments in this 2010 article about the stats charts in every plugin’s page. […] the download count includes direct downloads as well […] There is no “raw count” anywhere on that version number … Read more
These are my common plugins that I always install on all my blogs: Akismet – Fighting with spam. I use only this plugin and it does the job very well Auto Post Thumbnail – I’m lazy with setting the featured image. This plugin will auto take the 1st image in post content and set it … Read more
There isn’t any such feature directly in wordpress but there is a php library that do allow this kind of behaviour. Can’t comment on how/if it works as I haven’t tried it yet but it looks like it does the job. You might find it useful http://tgmpluginactivation.com/
localhost refers to the machine it’s running on. For example on my own site tomjn.com localhost is 127.0.0.1 as it always is. This doesn’t mean the hacker doesn’t know where to connect, it means the hacker replaces localhost with tomjn.com. Of course if I have a proxy sitting in front this won’t work, but keep … Read more
You can execute arbitrary SQL statements with wpdb::query(), including Data Definition Statements, e.g. function create_index () { global $wpdb ; $sql = “CREATE INDEX my_index ON {$wpdb->prefix}my_table (my_column)” ; $wpdb->query ($sql) ; return ; } Note: Because $wpdb->query() can execute arbitrary SQL, if the statement you pass to it contains ANY user input, then you … Read more
To add to @EAMann’s answer, you need to wrap your wp_get_current_user() call (or any call that tries to access a function defined within pluggable.php) within the ‘plugins_loaded’ action. So, if you’re putting this inside your functions.php file, do it like this: add_action( ‘plugins_loaded’, ‘get_user_info’ ); function get_user_info(){ $current_user = wp_get_current_user(); if ( !($current_user instanceof WP_User) … Read more
I had the same problem. In my case it was the Enhanced Media Library plugin, which looks as though it has not been updated in some time. I deactivated it, and all is good.