0
votes
1answer
42 views

Is there an admin hook that will let me read GET variable before it's too late to set the header Location

I need to redirect the page based on the query vars in my plugin admin menu. I don't know where I can hook in to read the query vars or the GET vars order to decide if the page needs to be redirected. ...
0
votes
1answer
26 views

How to replace settings in WordPress plugin from a theme

I created an array with some default settings in a plugin, and want to allow it to be replaced from functions.php in a theme without using stored data (eg. add_option). I want this to be just a hook ...
1
vote
3answers
113 views

What are the benefit in adding hook in the init() hook?

I see a lot of plugins using this approach to add a new hook, e.g. add_action('init', function() { add_action('SOME_LATER_HOOK', xxx); add_filter('SOME_LATER_FILTER', yyy); }); Why they don't ...
0
votes
1answer
40 views

What is the use of wp_schedule_event hook?

I want to do a cron(executes function at specific time, like email,db backup etc) job. I searched in wordpress, i got this wp_schedule_event Here they say it will execute job when someone visits ...
0
votes
1answer
27 views

How can I add a Custom Button to Add or Edit post / page next to Add Media?

I'm trying to add a custom button nearby the Add media on the wordpress Add and Edit Post/Page. How can I do that? Thank you very much for your help!
0
votes
0answers
28 views

Cart Discount when applied to the cart doesn't show the correct amount in Order Total using Woocommerce in wordpress [on hold]

I have being creating a new woocommerce plugin that will provide an option to the apply discount on top of the cart page. Now when there are products in the cart, the user will click on the Apply ...
0
votes
1answer
37 views

What happens when two or more plugins use the same hook?

Two of my plugins use the same filter hook: the_content. What happens in this case? Is there a priority handler, like which plugin will be served first? I would like to use both of the plugins. I ...
1
vote
0answers
40 views

I have 2 plugins using the same wp_login action hook and one is not working

so this is after a few hours investigating, I have s2member plugin and a custom plugin what happens is they are both using wp_login hook in this manner, s2member: add_action("wp_login", ...
0
votes
2answers
80 views

Hook for post permalink update

I would like to know what hook should I used when the permalink/url of a post is modified. My goal is to get the old permalink and new permalink so I can used it for my plugin. Thanks. [EDIT] Just ...
1
vote
1answer
79 views

What filter should I use to insert a button inside on Media>Add New

I am adding a new way to upload a media file to WordPress. So I am looking for a way to add a link or a button to the Upload New Media page. What is the recommended filter? Or is there another better ...
0
votes
2answers
53 views

Redirect returning users to a certain page?

Is there a way to redirect users returning to the site who are already logged in? Assuming something like: function returning_redirect() { //code here } add_action('auth_cookie_valid', ...
0
votes
1answer
83 views

Is it possible to create an action hook using do_action() within add_action()?

Is it possible to create a new action hook like do_action('my-hook-name'); inside a call to add_action();? I'm aware this code doesn't work, but I was thinking something along the lines of... ...
0
votes
1answer
25 views

How to create and use Custom hooks

I am newbie in wordpress. I have just created contact us plugin for my own project. In my plugin I have used many functions you can take a look of my code. I want to make this plugin based on custom ...
1
vote
1answer
86 views

Determine plugin name from within plugin_action_links filter

Is there any way to determine what plugin the plugin_action_links filter is addressing when it processes the filter? I'm trying to add some actions for each plugin on the /wp-admin/plugins.php page. ...
1
vote
1answer
331 views

“save_post” hook not triggered in WP 3.6.1

I developed a plugin having a custom metabox that is using the "save_post" hook to store data. The plugin is old 18 months and is used by thousands of customers, so I'm pretty sure everything is good. ...
0
votes
0answers
20 views

How to return a different page than the one requested

Description of the problem I am now developing a plugin whose purpose is to change the contents of the page a user requested depending on different variables (like, for example, user's location). By ...
0
votes
1answer
70 views

Quick press publish post hook

To execute a function during publishing post publish_post action hook is used. But what is quick press post publish hook?
0
votes
1answer
235 views

using wp_footer hook in a plugin

I'm using the wp_footer hook into the plugin and it doesn't work, but when I copy the code to the "functions.php" file of the active theme it does work, what is the possible problem in this situation ...
1
vote
2answers
24 views

Is it possible to add an action to the currently running action?

My question is very simple but I haven't found this answer yet. Here's an example: class MyClass { public function __construct(){ add_action('init', array($this, 'init')); ...
0
votes
1answer
138 views

Remove rewrite rules generated by plugin during deactivation‎

I have a simple plugin like the following add_action('generate_rewrite_rules', function ($wp_rewrite) { $wp_rewrite->rules = xxx + $wp_rewrite->rules; }); if (is_admin()) { ...
3
votes
1answer
146 views

Call activation hook multiple times

I have a plugin that does some initialization stuff using register_activation_hook called from its __construct(). I've since extended my plugin to add functionality to it. For the sake of ...
2
votes
1answer
384 views

How do I handle multiple Submit buttons in plugin's option page?

I'm developing my first plugin for WordPress and I'm getting a grasp of the whole hook system. I'm now stuck on a (probably) small issue, that I could possibly circumvent, but I'm afraid of coming out ...
0
votes
1answer
51 views

Why enqueue styles on hook

Why do we need to enqueue styles on a hook, why not just enqueue them straight in like this? wp_enqueue_style( $handle, $src); the codex page gives an example of using a hook but doesn't explain ...
2
votes
0answers
158 views

How to add custom button to new media upload interface [duplicate]

I am developing a plugin and i want to add my own button to the wordpress media upload interface (WP version 3.5). Right next to the standard 'insert into page' button, i want my button to be there, ...
2
votes
1answer
94 views

How to save the values of checkbox to the register setting?

<?php function default_menu() { <form action="options.php" method="post"> <?php settings_fields( 'sample_check' );?> <input type="checkbox" name="sample" value="nofollow"/> ...
0
votes
1answer
189 views

Restrict certain actions to plugin-specific admin menu pages only

I'm working on a plugin and want to restrict some things to my plugin-specific admin menu pages only. Therefore, I write the slugs being returned when adding (sub)menu pages into an array so I can ...
2
votes
2answers
576 views

How to modify post content before writing to database?

Hi~ I'm back again and I'm trying to add another function to the script I was working on a plugin that notify my friends of new post that mentions(@) them. Now I want to change the plain text of my ...
2
votes
2answers
133 views

Placement of Code in Plugin for hooking `save_post`

I ran into a strange Problem today developing a new Plugin. I set it up as usual, creating the f711-roomprice folder in the Plugindirectory, and creating the f711-roomprice.php as well as an inc ...
1
vote
1answer
144 views

How to display a message about updates in the plugin list

I am trying to use the hook in_plugin_update_message in order to display a one line message below the name of my plugin in the admin plugin list section. However, the function called in the hook does ...
2
votes
1answer
190 views

publish_post plugin hook doesn't always pass $post->post_content

I've written a simple plugin that grabs the contents of a post, as the post is published, and sends them to an external site for archiving. This generally works but when dealing with posts that ...
1
vote
3answers
298 views

How can I filter blog name?

I want to filter the blog's name for Google's user agents. I have tried the_title, the_content, comment_text, single_post_title, wp_title, category_description, bloginfo hooks, but none of them ...
2
votes
1answer
53 views

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 ...
1
vote
1answer
82 views

Conditional hook based on the core function that is calling it

In a Multisite, I'm applying the filter get_blogs_of_user to sort the "My Sites" admin bar menu, where the sites are listed by blogname: What happens is that I'd like another order elsewhere, where ...
0
votes
1answer
307 views

Plugin uninstall function is not working

I am updating my plugin for Wordpress version 3.5 compatibility. These are my important plugin files: Sort_SearchResult_by_Title.php: <?php if(!class_exists('Class_Sortsearchresults')) { ...
0
votes
1answer
1k views

Using the 'draft_to_publish' hook (post status transition)

I am trying to use the draft_to_publish hook (http://codex.wordpress.org/Post_Status_Transitions) to run a function when a post that is a draft becomes published. This hook does not appear to be ...
0
votes
1answer
87 views

How do I replace title with my plugin?

I am developing a plugin for WordPress 3.5. My blog's default title is "Test". Here is some code of my plugin: add_filter('wp_title', 'my_replace_title'); function my_replace_title(){ return ...
0
votes
1answer
86 views

template_redirect not being called when using ajax

Usually I hook all my custom plugins code with the template_redirect hook but one of the issue I encountered is it does not work for the ajax call. So if I want to target both standard calls and ajax ...
0
votes
1answer
71 views

What's the hook for filtering every texts of site?

I'm developing a plugin to replace a character that google doesn't show it with an accepted character. I want to get all the texts that wordpress returns (content, comments, title, names, etc.) but I ...
1
vote
2answers
95 views

Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. Not Work: ...
3
votes
5answers
372 views

How do I make a theme “plugin-ready”?

How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?
1
vote
1answer
226 views

Adding option to Gallery shortcode

just starting out in WP dev, and I'm looking for any guidance I can get. What I'd like to do is use a hook or filter to add my own option to the core WP gallery shortcode. I would want it to work just ...
0
votes
1answer
75 views

Looking for Hook that is fired after a plugin or wp upgrade is installed/updated

I'm trying to write some code to sms me whenever someone updates/installs a plugin, or updates the WP core, but I can't seem to find a hook that gets fired when this happens. Does anyone know if there ...
1
vote
0answers
59 views

Add a new confirmation page before saving

I'm going to add a hook that does some modifications of the text before saving. Before making the changes permanent, I would like the user to confirm the changes after a "save_post" hook. Is there a ...
0
votes
1answer
323 views

Get user logged in status from within a plugin. $current_user not defined

I'm writing a plugin which adds a class that creates an endpoint for third party software to make API calls to and check if the current user is logged in. Here's a stripped down version of what I'm ...
1
vote
1answer
802 views

How to use filter hook 'post_updated_messages' in coherence with action hook 'save_post'

I am trying to send out e-mail, SMS and IM notifications to group members of this WordPress website, whenever a WordPress page in their user group has been published/updated. I figured using the ...
1
vote
1answer
454 views

correct way to call javascript into hook function

function node_wp($post_ID) { global $post; $post_title = get_the_title( $post_ID ); $post_url = get_permalink( $post_ID ); $json = array( 'title_post' => $post_title, ...
0
votes
1answer
64 views

Checking url from plugin

I'm trying to change the login url from wp-login.php to simply 'login'. I'd been looking through another plugins source to find ways of doing it. Some of the applicable parts that I've got so far: ...
1
vote
1answer
38 views

Is there any way to allow a plugin to write over a previous version?

When installing a plugin, it will not install if the directory to which it is attempting to install already exists. This means that users of our plugin must first manually deactivate and delete the ...
4
votes
1answer
98 views

How Do I Load My Action Earlier Enough?

With add_action, I want to intercept as early as I can in my plugin and send a 304 Not Modified header per some rules. Does anyone know what the order is of events? When I view this page, it seems to ...
0
votes
1answer
106 views

Bug: Post needs to be updated twice when adding action for save_post hook

My function does exactly what I want it to do: I'm trying to add/update meta fields in another post type when an "events" post is saved. Except the post needs to be updated twice for the information ...