add_query_arg not working

If you take a look where the category_link hook is defined in category-template.php you’ll see this particular hook passes on two variables. The second variable is the category ID, but your callback function treats that second incoming variable as a query object. Simply put, you’re looking for a query_vars property/key that does not and cannot … Read more

MySql database help for a plugin

Hi @ntechi: I think this is what you are looking for: $sql =<<< SQL SELECT id FROM myrp_ratings AS rat, INNER JOIN wp_comments AS com ON com.comment_ID = rat.comment_id WHERE 1=1 AND com.comment_author_email=”%s” AND rat.value != ‘0’ AND rat.value != ‘1’ LIMIT 1 SQL; $sql = $wpdb->prepare($sql,’[email protected]’); $id = $wpdb->get_var($sql); if (is_null($id)) { $wpdb->query(“INSERT INTO … Read more

Force CSS and JS loading of plugin only where needed

is_admin() is useful for the front end. The load-$pagenow hook and a few others are useful on the backend. wp-admin/admin-header.php, for instance, contains: do_action(‘admin_enqueue_scripts’, $hook_suffix); do_action(“admin_print_styles-$hook_suffix”); do_action(‘admin_print_styles’); do_action(“admin_print_scripts-$hook_suffix”); do_action(‘admin_print_scripts’); do_action(“admin_head-$hook_suffix”); do_action(‘admin_head’); Note the $hook_suffix variable, which you can var_dump() then and there to know what its value is when your plugin’s page is being loaded.

How do plugins get executed automatically from wp-content?

I know, myself, using a multi site WordPress install, plugins dropped into the mu-plugins folder (wp-content/mu-plugins/) are activated automatically. In this case mu representing must use. However, I am not 100% positive if this is dependent upon the type of install a single site blog install or multi site/network install. I found an article outlining … Read more

First WordPress Plugin – Stat Issues

I’m having the same problem. Take a look at the opening comments of content-types-wordpress-plugin.php, it looks like there are extra line breaks between each line, which may disrupt the parser that pulls out the version number, etc. If you don’t see the extra breaks when you develop locally, you may have to play with the … Read more

Need help restoring my WordPress blog

Have you tried removing the wp-cache folder? I had a bad update of a different plugin once and simply “uninstalling” it by removing it from the wp-content/plugins folder allowed things to run normally and I installed an older version of the plugin.

How to determine if a plugin affects your file-system

Such tracking is not practical, at least not in context of WordPress. When we use software we don’t fully realize just how much activity is going on behind the scenes. Tracking it is massive overhead and can easily ruin performance. I remember plugin that use checksum-based verification on WordPress files, but I don’t know if … Read more