Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

1
vote
3answers
516 views

Two-step login process - Is it possible?

Is it possible to do the following with Wordpress (without hacking too much code - I would like to make this a general plugin using simple hooks)? Log in with the username/password. If ...
0
votes
1answer
223 views

How to get the password and username of the add new user form (admin back end) in wordpress

I am trying to get the username and password that entered by the wordpress admin in the add new user screen to use those into creating a webmail account using cpanel api. How to do that? is there is ...
6
votes
3answers
4k views

Calling a Function After New Post Creation for a WordPress Custom Post Type?

Assume I created a new post type 'product'. Is there a way to perform a function (user created) when this new 'product' post has been created?
2
votes
1answer
7k views

How to customize woocommerce related products?

I have the following lines of code in my website that will display the related products at the bottom of my single product page in WooCommerce... functions.php: // display upsells and related ...
2
votes
2answers
284 views

Load different template file when condition met?

If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy. If I'm doing some logic checking in the hook init and say my ...
2
votes
2answers
2k views

When calling wp_title(), do you have to create some kind of “title.php” file?

... or does wp_title() already handle the various contexts in your blog? This could clarify for me how I can achieve a reusable index.php file without having all the conditional statements inside it ...
2
votes
1answer
2k views

add_action('wp_ajax_[action name]', myfunction) problem

I'm trying to integrate ajax in wordpress using the wp codex guidelines. In the PHP I added: wp_enqueue_script ( 'my_ajax', ADMIN_URL . 'js/ajax.js','jquery','1.0.0' ); wp_localize_script( 'my_ajax', ...
2
votes
5answers
6k views

Adding onload to body

I'm currently trying to develop a plugin that will embed a Google Earth Tour into a WP post / page via a shortcode. The issue I am running into is that for the tour to load, I have to add an ...
1
vote
1answer
189 views

Alter image output in content

I'm trying to implement the JAIL javascript into my WordPress install. The javascript requires me to add a data-attribute and change the output html of images. I have been looking through the codex ...
1
vote
1answer
168 views

filter the_title problem in nav

Hi I have a problem with the_title filter: I have this code at my constructor: add_filter( 'the_title', array($this, 'change_title') ); and this as callback (for testing purposes) public ...
0
votes
2answers
929 views

Hook 'wp_enqueue_scripts' priority has no effect

In a theme I am working there are up to 3 Stylesheets. I am using the hook 'wp_enqueue_scripts'. The order of the stylesheets is important for overwriting styles. I have a code like this: ...
0
votes
3answers
1k views

Hook on trash post

I want to perform an action when I delete one of my custom post types, which hook should I use: wp_trash_mycpt or trash_mycpt My action should run solely when mycpt is in the 'publish', 'draft' ...
0
votes
1answer
2k 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
358 views

run script on publish

I am trying to run a script when a user publishes / updates a post. I am using the filter: wp_insert_post_data The problem I am having is the script is a php file outside of WordPress but on the ...
7
votes
1answer
840 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 ...
5
votes
4answers
480 views

Is there a limit to hook priority?

When I wish my filter or action hook to override all others, I will assign it a priority of 999. However, lately I have been seeing some people use extreme values for the priority, such as 20000, and ...
5
votes
2answers
2k views

Earliest hook to reliably get $post/$posts

What's the earliest possible action I can hook into where I'll be able to access the global $post/$posts variables on both the front and back ends? I've tried looking through the Codex reference, Adam ...
4
votes
1answer
615 views

Is there a Wordpress core & plugins update action hook?

I would like to run several actions on a website once WP core or any of the plugins have been updated using the built-in update process. Is there a way to do it? I would prefer if I could run ...
3
votes
1answer
184 views

Perform action on WPMU blog deletion

Hi guys :) I know there is the wpmu_new_blog action hook which enables us to perform an action when a new WPMU blog is created. Is there something similar to this which enables us to perform an action ...
3
votes
2answers
648 views

How to Debug the 'save_post' Action?

Is it possible to validate PHP code? I have a Custom Post Type (Film) with Custom Meta Boxes. Everything is working fine, I can add new Films and details to the Custom Meta Boxes. My problem is ...
3
votes
3answers
2k views

How to hook wp_list_pages?

How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?
2
votes
2answers
2k views

Add subtitle to Woocommerce product title

I'm using WooCommerce on a site built with Pagelines Framework. I need to have a subtitle/customisable field appear under the product name anywhere it appears in the site. As it is, WooCommerce ...
2
votes
2answers
147 views

add_action on inherit post status

I'm trying to use the add_action() hook to run a custom function, but am struggling with the post status. I originally tried using: add_action('pending_to_publish_portfolio', 'my_function'); ...
2
votes
2answers
1k views

Check if action hook exists before adding actions to it

I am trying to add a rel=next and rel=prev link tags to the head element of image.php template file. I have Wordpress SEO installed and I like to hook to this plugin wpseo_head action hook to achieve ...
2
votes
2answers
687 views

Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?

I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its ...
2
votes
2answers
652 views

Display info from custom fields in all images' HTML

Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here). The field stores the name of a ...
2
votes
1answer
1k 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
2answers
158 views

Update meta values with AJAX

I am working on a voting system in Wordpress. I first made it with GET requests but someone told me you should not use GET for this, So I started working with AJAX to update custom fields/meta values, ...
1
vote
3answers
212 views

Hook Widget to Woo Theme in functions.php

Right now I am adding a sidebar above my woocommerce products. How can I hook the sidebar to my theme. Have registered sidebar and it works. register_sidebar( array( 'name' ...
1
vote
2answers
136 views

How to trigger the core WPLANG to make automatically set a language when the theme is activated? [duplicate]

I'm developing a theme especially for Bānglā blog posting, and it'd be under GNU license. I questioned about a Calendar Widget translation with some problems today, and got a comment saying: I'm ...
1
vote
1answer
63 views

How to hook some Unicode texts into calendar widget safely?

I collected a good numerals replacing function for WordPress calendar: function make_bangla_number($str) { $engNumber = array('0','1','2','3','4','5','6','7','8','9'); $bangNumber = ...
1
vote
3answers
432 views

Filter specific shortcode output?

Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this: add_filter('shortcode_output', 'my_filter_function', 2); function my_filter_function ( ...
1
vote
2answers
432 views

gform_after_submission content appears immediately after <body>, not in post body

I have the following function that successfully uses form fields (IDs 13 and 18) from a Gravity Form (ID 18) as parameters within wp_query. This displays a list of posts with specific taxonomy terms ...
1
vote
1answer
80 views

Create hooks based on an array of hook names?

I have this idea where I would create a class that would take in a set of hook names then create them, for me to use when ever, and where ever. Currently the way to create a hook is we do something ...
1
vote
2answers
102 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: ...
1
vote
1answer
109 views

How to Remove the “Restore” Link in Quick Edit?

I want to know is there any hook to remove the Restore link in the edit page - trash page? /wp-admin/edit.php?post_status=trash I know I can hide it with a css/jquery trick, but I prefer to use a ...
1
vote
1answer
910 views

Wordpress Delete hook with wp_delete_post function?

I have this action/hook: add_action( 'before_delete_post', 'my_delete_function' ); function my_delete_function($post_id) { global $wpdb; $achievement = get_the_category($post_id); $h = ...
0
votes
0answers
40 views

Hook into trash_post_comments, update_user_meta

I have a theme where the author get points for posting posts and comments. When I trash a post, the user get 1 point removed from their score. This works fine with this function: However... When I ...
0
votes
0answers
13 views

Use admin notices to show errors [duplicate]

I'm using the transition_post_status hook to perform some operations after publishing a post. If an error occurs, I would like to use the admin notices to show a message to the user: ...
0
votes
1answer
89 views

WPMU Hook for archive or deactivate blog?

I am trying to automatically clear the blog's cache when it is Archived (or Deactivated is fine) in a Multisite install. This is useful for anyone using a caching program like WP Super Cache as an ...
0
votes
1answer
1k views

How to add a new product type on woocommerce product types? [closed]

I want to add a new custom "product type" to woocommerce plugin: Tried to duplicate one of currently exist product type files (woocommerce template structure) as a new file (file name and inside ...
0
votes
2answers
90 views

Print shortcode in custom action hook not where the shortcode is entered

I have added a custom action hook into my theme. I want to be able to enter a shortcode anywhere in the_content() and have the shortcode print were the custom action hook is rather then the point from ...
0
votes
1answer
85 views

Find out if request is for custom post type archive before query runs

I am writing a plugin that is modifying the RSS2 feed for a podcast that uses a custom post type. After the query runs (on action hook template_redirect; See this question for why), I'm checking to ...
0
votes
1answer
49 views

How to center oEmbedded content

I understand you have to paste the link that you're embedding without any code wrapping around it, but how do I force the embedded content to be centered? Currently, the default is aligning to the ...
0
votes
1answer
441 views

List posts based on First letter of Posts

I want add a Pagination [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] .......[Z] Easy Post Title - By Admin on 2013 post content....bla bla bla... Example Post - Another Test ...
0
votes
1answer
99 views

An action hook where a comment meta is updated

By analogy to the hook on post meta update, I use the following code for hooking when comment meta value is updated. My comment meta key is "consider" and can have 2 values: 0 and 1. My Goal is to ...
0
votes
1answer
88 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 ...
0
votes
1answer
166 views

Hook to be used when creating a database table

I read the Codex and some other tutorials describing the process of creating a new table for WordPress. I thing that the steps are pretty straightforward; however, I'm encountering a small problem. ...
0
votes
3answers
128 views

About Hooks and Filters

Well, am having a very hard time understanding the difference between Actions and Filters. I do use actions in my code, but am a rookie and I don't know even a slightest bit of Filters. I have been ...
0
votes
4answers
515 views

How to fix my old theme so it loads jQuery properly

I have an older theme that is loading jQuery 'manually', and this conflicts with all plugins that are trying to use jQuery. The following lines are included in the theme header: <script ...