Articles of hooks

Put code into body tags near top, using a plugin

How do I use a plugin to put this inside the body of every page on my WP site, for facebook integration. (Yes, I know other plugins can do it, but I want to do it myself.) Facebook recommends as close to the top of the lead body tag as possible. Thanks! <script>(function(d, s, id) […]

Change WordPress RSS link with filter?

In my theme i use add_theme_support( ‘automatic-feed-links’ ); to enable the rss links. But i want to create an option to use Feedburner for the main rss feed, my problem is that i don’t know how i can hook in and change the default rss link?

How to check what kind of saving it is?

I use save_post hook, and I have to know inside this hook function, whether it is a publishing ( draft to publish ) or is it an updating, like publish to publish or draft to draft. Is there a way to check it? I can not use draft_to_publish hook for this, and I’ll explain why: […]

comment_email hook doesn't seem to work for comment editor field

I am building a plugin that allows users to PPK encrypt their users’ IP/email data. Thus, IP/email data is set to dummy values in the comments table and encrypted values are stored in corresponding meta fields. I’m successfully using the comment_email hook to lookup email addresses in the admin comments browser from my encrypted meta […]

How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?

Info about wp_die from codex: Kill WordPress execution and display HTML message with error message. A call to this function complements the die() PHP function. The difference is that HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. I have code: […]

Remove and restore one shortcode

I would temporarily remove a shortcode, make something and restore it… it’s possible? // override default wordpress “the_content” hook remove_filter(‘the_content’, ‘do_shortcode’, 11); add_filter(‘the_content’, ‘my_the_content’, 11); function my_the_content($content) { remove_shortcode(‘some_shortcode’); $content = do_shortcode($content); // restore the shortcode add_shortcode(‘some_shortcode’, ‘?????????????????????????????’); return $content; } the problem is how restore it correctly… original shortcode is in a class, eg.: […]

How to send an automated user 'inactivity' email?

I’m currently working on a editorial heavy WordPress site, and one thing that I’d like to implement is a functionality that sends someone of a specific role (in this case contributor/author) an email alert when they haven’t created/published any new content in a set period (for example 20 days). However, I have no idea what […]

Removing labels and <br> tag on WordPress's default login form

I am customizing the login form to more closely resemble Google’s minimalist form, which has no form labels, and instead relies on placeholders to prompt users for the input fields. The form starts out looking like this: <p> <label for=”user_login”>Username<br /> <input type=”text” name=”log” id=”user_login” class=”input” value=”” size=”20″ /></label> </p> WordPress has no method to […]

Am I using the right hook for removing quicktags on the admin TinyMCE?

This is more of an excercise than something for a client. Anyway, I’m trying to disable the quicktags when you’re on the dashboard and you click on Comments > Edit Comment. On that screen, there’s a TinyMCE with quicktags and the textarea has an id of “content”. I know in the WordPress core, this can […]

Remove Woocommerce product link

I’d like to remove the link from the Woocommerce product listings. I don’t need the user to see the product detail pages, we are going to use Quick View instead. Anywho, I have been searching and everything I’ve found is outdated. This is the current content-product.php file: https://github.com/woothemes/woocommerce/blob/master/templates/content-product.php and there are no anchor tags to […]