Tagged Questions
0
votes
1answer
29 views
Hooks - Query about WooCommerce plugin integration to non-compatible theme
I am quite new to WordPress and wish to learn more about hooks and how to use them.
Could anyone point out the necessary hooks in this page.php code to replace the markup in the following WooCommerce ...
0
votes
1answer
27 views
How to make plugin work in each template in wordpress
I am new to plugin development .I want to get all images of a particular page/post and want to show them as slideshow below the page ..Currently i am able to gather all images in media library and ...
1
vote
0answers
34 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
43 views
the_posts hook, which set of posts?
I want to modify search results. Currently I hook to the_posts and check wp_query->is_search to determine if I am looking at the search results page.
However, I noticed that the_posts is executed ...
0
votes
1answer
64 views
Does the 'nav_menu_css_class' filter accept 2 or 3 arguments?
I've been using the nav_menu_css_class filter in one of my plugins, implemented as:
add_filter( 'nav_menu_css_class', 'wbwcrf_nav_menu_css_class', 10, 3 );
function wbwcrf_nav_menu_css_class( ...
2
votes
0answers
61 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 ...
2
votes
1answer
86 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 ...
0
votes
1answer
82 views
Wordpress image resize hook
Any relevant help will be appreciated.
I want to make rounded cornres on images off certain image size. For example I have
add_image_size('xx', '320', '320', true);
Can I hook to this function and ...
1
vote
3answers
101 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 ...
0
votes
1answer
298 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
61 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 ...
1
vote
2answers
34 views
Adding a form at the end of the content
I'm trying to add a little form after each post for a plugin I have to code, but I'm not very familiar with Wordpress. By using add_action with the_content as hook, I was able to add some text to the ...
1
vote
2answers
130 views
How do I display only the latest post on my home page, while maintaining proper plugin hooks?
What I'm trying to do is display the most recent post (a la my theme's "single.php") on my "home" page.
This is complicated by the fact that I have certain plugins (specifically, Scripts n Styles) ...
5
votes
2answers
59 views
Is there any debug toolbar that shows whick hooks are called for the current page in Wordpress?
In Django there is a debug toolbar that shows which template files and hooks are called while rendering a page.
Is there any plugin that shows which hooks are called for the current page in ...
1
vote
2answers
60 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:
...
2
votes
2answers
183 views
How To Determine If A Filter Is Called In A Sidebar/Widget Context?
So I have a plugin that appends or prepends an enhanced author biography to the content of a page/post/custom post type.
It does this by hooking to either the_content or the_excerpt and ...
0
votes
2answers
155 views
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 ...
1
vote
0answers
72 views
Hook into existing tinyMCE button
Is there a way to hook into an existing tinyMCE editor button?
I have a plugin that currently has a button on the editor and it shows a popup-box when clicked. This box has tabs inside.
I would like ...
0
votes
2answers
193 views
What are ideal hooks to call register_sidebars?
Where should a plugin ideally hook to call register_sidebar();?
Will init do just fine?
function my_plugin_register_sidebars() {
$args = array(
'name' => 'foo'
'description' ...
0
votes
1answer
233 views
How to only hook on Single.php after content?
I am currently hooking on the_content() but that goes through the Wordpress loop too. How can I only hook on the Single.php page?
Also, is there a way to only look on the first X posts in the ...
0
votes
1answer
52 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:
...
0
votes
1answer
168 views
OOP Plugin: Where should I place the action hooks in the class?
Where in my admin class should I place the action hooks for adding css, scripts and the add menu page?
In the __construct? Or should they be placed in a method?
0
votes
2answers
557 views
How to use a WooCommerce action hook?
I am wondering how you would implement the following hook.
do_action( 'woocommerce_process_product_meta_' . $product_type, $post_id );
What is the correct way to call a call the action from a ...
2
votes
2answers
176 views
Which hook should be used to validate custom form fields on the login form?
I've added a custom input field with login_form hook.
So, I need to process the post data to validate.
I've used the lostpassword_post for lostpassword_form and works great, but I cant find a hook to ...
0
votes
2answers
230 views
How to get post ID with hooks publish_post, new_to_publish, etc
I have two plugins, one uses the function wp_insert_post(), the other has a code like this:
add_action('future_to_publish', 'myFunc', 10, 1);
add_action('new_to_publish', 'myFunc', 10, 1);
...
0
votes
1answer
85 views
Turning on output buffering in a wordpress plugin
My wordpress plugin uses sessions for handling various things, and on the production site I'm testing it on output buffering is not on by default so I'm getting a lot of messages such as these:
...
7
votes
1answer
1k views
Passing a parameter to filter and action functions
Is a way to pass my own parameters to the function in add_filter or add_action.
For example take a look in the following code:
function my_content($content, $my_param)
{
do something...
using ...
0
votes
2answers
173 views
How to deactivate my plugin upon deactivation of NextGen
i'm writing this plugin and i need to deactivate it when NextGen is deactivated:
<?php
/*
Plugin Name: Plugin Name
Description: Description
Version: 1.0
Author: Author
Author URI: Author URI
*/
...
9
votes
5answers
1k views
How to include code only on specific pages?
I'm learning about plugins and shortcodes. I noticed that when I activate my plugin its code gets loaded on all of my pages-- even pages that don't have my shortcode. (I don't mean content vs. admin ...
0
votes
2answers
1k views
How can I edit post data before it is saved?
I have a plugin and I would like to be able to run the post content through some filters before it is saved to the database. From looking at the plugin api, I see that two hooks that look like they ...
1
vote
1answer
88 views
Showing Notifications While Activating Plugin
I want to give errors like this, while activating my plugin.
Which hooks should i use ? Can you share simple examples ?
In shortly,when user activate my plugin, is a directory's CHMOD isn't 777 , ...
3
votes
2answers
333 views
How can I log a user out of Wordpress before the page loads?
I would am using the code below so that on my wordpress site if ?logout is appended to the end of the URL the user will be logged out. This works well - if the user visits a page such as ...
1
vote
1answer
499 views
How can I see all the actions attached to an “add_action” hook?
I'm working with the admin bar and trying to debug some of the menus and their priorities.
I know several callbacks get bound to actions, such as this one:
add_action( 'admin_bar_menu', ...
0
votes
1answer
48 views
Create categories on blog creation? [closed]
I hav ea wordpress network running, what I'd like to do is create a plugin which detects when a new blog is created in the network then automatically adds a set of predefined categories to the blog.
...
0
votes
1answer
400 views
Hook for page Request?
I want to run a function that looks at the current url params of the page that is requested and sets a cookie based on those params.
So, I guess I'm looking for:
The Wordpress Hook that allows me ...
0
votes
1answer
2k views
How to automatically activate users after registration without activation email?
I want to auto-login my users after signup without an activation email requirement (I'm not concerned about spammers). How might I go about doing this? Thanks!
0
votes
1answer
186 views
Creating a plugin that will display text on every page
I know there is going to be an easy way to do this but I just can't seem to find the best practice for the following;
I have a plugin which when complete should generate HTML on every page, I want it ...
0
votes
1answer
182 views
add action for displaying posts using a shortcode
I'm developing a simple plugin for letting a user insert a post from the frontend.
I have a shortcode [add-post] which a user can put on any page, say, for eg. My Wall Page
Now on My Wall Page a ...
0
votes
1answer
57 views
Hooks to run after a core upgrade?
Are there any hooks for running plugin code after a core upgrade?
Specifically, I'm running into issues that a users wp-admin column choice in the 'Screen Options' are modified after an upgrade - I ...
0
votes
1answer
71 views
Display Plugin Panels Outside of Admin Areas
I'm trying to find a way to display the work area content of different plugins on pages/posts/areas aside from the admin backend.
For example, how would I display the options panel for a certain ...
1
vote
2answers
203 views
Is it possible to remove this action? (as it's added just before it's called)
In wp-signup.php there are these lines:
add_action( 'wp_head', 'wpmu_signup_stylesheet' );
get_header();
I need to remove wpmu_signup_stylesheet from the wp_head action, but I seem to be ...
4
votes
1answer
395 views
Registering Class methods as hook callbacks
I'm not sure if I have done this correctly.
As I understand it:
if I have a class foo and a static method bar I can register that as the callback by passing the array array("foo","bar") as the ...
0
votes
1answer
28 views
Plugin Hook When New Author Added
Is there a way to add a hook for a plugin when a new author is added by the administrator?
I would like to be able to add that user to my plugin database table.
Thank you.
0
votes
1answer
291 views
How to display a link in the footer section
i'm using the BAAP Mobile version plugin and the footer link that switches between desktop and mobile version is being displayed outside of the wrapper>footer divs. Is there a hook or a method to have ...
1
vote
2answers
288 views
Hooking in to replace the Sidebar/Widget areas
The Goal: To replace the sidebar on all sites across my network with content loaded from a plugin, across all themes.
I need a way of over-riding the sidebar/main widget area on all sites across my ...
0
votes
1answer
654 views
Adding custom Field To The Posts Listing
Are there plugins or hooks to editing custom fields just from the posts listing in admin panel?
0
votes
1answer
259 views
Hook for plugin to insert into entry-meta
pretty simple. I'm creating a plugin and I want to dynamically insert some text that will change every hour into the line that is directly below the title of a post (So filters are no good). It's the ...
3
votes
2answers
378 views
Seeking clarification on page request life-cycle
I'm just trying to get my head around the "life-cycle" of a typical page request in WordPress. The Action Reference page lists 38 actions that occur during a typical page load, but two things aren't ...
2
votes
1answer
695 views
What is the 'admin_action_' . $_REQUEST['action'] hook used for?
There's an action hook triggered in admin.php called 'admin_action_'.$_REQUEST['action']. Unfortunately, it's a bit useless for plugins as it's triggered at the very end of admin.php, after ...
1
vote
3answers
330 views
Good tools for locating hooks in a wordpress page/admin interface/blog post?
I've recently started using the Hikari Hooks plugin for Wordpress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where ...