Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

2
votes
1answer
451 views

Gravity Forms field entries into wp_query loop [closed]

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
0
votes
1answer
28 views

How to add a class to Buddypress avatars in the Activity stream? [closed]

I'm in the process of trying to integrate bootstrap with Buddypress and am trying to add a class of "media-object" to Buddypress avatars. I could do this by mimicking the Bootstrap CSS, but in the ...
1
vote
1answer
23 views

Filter Posts from the Main Query

I want to conditionally merge a custom post type with my posts post type, based on a custom field. If the field's value is 1, then I want I need those custom posts to appear in the same loop as posts ...
0
votes
1answer
28 views

Plugin Hook: Get posts

I am building a WP plugin. It shows several featured post images with titles atop. It will have a spot on the admin bar to tell it what the featured posts are. What hook do I use to get the post's ...
0
votes
1answer
18 views

New User Save Filter

I'm using the new(ish) filter add_action( 'user_new_form', 'funcy', 9 ); to add custom fields to Create A New User page. I'm then using add_action( 'personal_options_update', 'save_user_meta' ); ...
0
votes
0answers
18 views

URL mod rewriting for my custom links

My Actual link :- http://nanhai.com/nanhai-overview/162/ I want it like :- http://nanhai.com/nanhai-overview/xyz/ My code add_action('init', 'add_actor_url'); function add_actor_url() { ...
1
vote
2answers
79 views

Wordpress auto login after registration not working

So I looked up a bunch of threads trying to figure out how to automatically log a user in after registration, and came up with this. function log_me_the_f_in( $user_id ) { $user = ...
2
votes
1answer
828 views

How to change title attribute returned by comments_popup_link()?

I can change label of comments by altering Comment(s) from parameter of following function: comments_popup_link('No Comments;', '1 Comment;', '% Comments;'); But, seems that title attribute is ...
3
votes
2answers
726 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 ...
0
votes
1answer
32 views

get_the_post_thumbnail not working inside wp_get_nav_menu_items hook

if ( ! is_admin() ) { add_filter( 'wp_get_nav_menu_items', 'display_last_posts_for_menu_item_ts', 10, 3 ); } function display_last_posts_for_menu_item_ts( $items, $menu, $args ) { $menu_order = ...
1
vote
1answer
23 views

Wordpress capabilities and restricted categories access

I've a Wordpress blog to share content with some people only. Users has to login to access this website. I created new roles and new capabilities on this blog. I've got some articles which belongs ...
0
votes
0answers
34 views

Hook before & after plugin / core update

I'm working on a maintenance plugin for my website and I want to enable it before plugin/core upgrade starts and disable it after plugin/upgrade ends. Any ideas ? Thanks! :) PS: all I know is I can ...
1
vote
0answers
198 views

How to set a custom path, for ajax image upload folder in admin?

I am coding my first Wordpress plugin that handles some data for a custom (shop-like) post type. It also has an image uploader within a metabox, where you simply drag in your images and it ...
26
votes
6answers
4k views

Where Can I Find a List of WordPress Hooks?

Where can I find a list of all the WordPress hooks and over-ridable functions (pluggable, scriptable, etc)? Edit: Plugin is here: ...
0
votes
1answer
22 views

Which method to use when deleting posts from the front-end

I am trying to enlist all my posts on the front-end along with delete and edit links (using the shortcode API). I am having difficulty with the delete links. To me the most obvious way to handle ...
1
vote
4answers
645 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
28 views

apply_filters/do_action tag characters limit

Does apply_filters/do_action $tag name have a characters limit? Can be any problems if the tag name is way too long? I ask this because I know that WP transients have a limit of 45 characters. FYI, ...
0
votes
1answer
28 views

Add_menu_page() error message -> “You do not have sufficient permissions to access this page”

I'm currently building a website for a friend and have assigned him the user role of editor. I don't want to give him an administrator role in case he breaks the layout. Anyway, I am using ...
-1
votes
2answers
345 views

How to pass hook variable to function?

I have a function that has an add_action inside it that calls the user_register hook. I would like to be able to echo the variable $user_id from the user_register hook and the $_POST array as well. ...
0
votes
1answer
43 views

get_post_meta not working inside a function in functions.php but works outside

function notify_new_posts($post_id) { $keyval = get_post_meta( $post_id); $buyer_wdistance = get_post_meta( $post_id, 'cf_wdrive'); //$buyer_wdistance = $keyval['cf_wdrive'][0]; ...
0
votes
1answer
45 views

Replace admin header logo with an image

I want to replace the default WordPress admin bar logo to my custom logo which is a PNG file. I have tried a code it's not working. function custom_logo_admin_header() { echo ' <style ...
1
vote
1answer
21 views

How to modify how the_content outputs a link to an internal page

I like the default add link dialog in the wordpress editor. IT allows for easy linking to internal pages. I need to modify the output of those internal links. Right now its outputting: <a ...
4
votes
2answers
514 views

Is there a hook to put stylesheet and/or JS inside iframes (thickbox or tinyMCE) in admin area

I'm working on my admin area theme and I wanted to make some modifications on the way the thickbox and tinyMCE looks. I could make most of the changes through adding custom stylesheets and JS to my ...
0
votes
1answer
33 views

Retrieving post ID from current page

I am following the tutorial here. Wordpress Ajax is a bit complicated but this tutorial helped me out a bit. The only question I have is, when I view any page, I want to be able to get the current ...
5
votes
1answer
1k views

Difference between do_action and add_action

This question might be wrong, I am not sure about it. Because I am not clear on this. I know add_action it is used to to hook our function to the specified function. For example ...
0
votes
1answer
32 views

$wp_query when new WP_Query

I'm trying something but I have an issue with WP_Query. I've an Hook on the_post in order to add some variation on the query. add_filter('the_posts', 'query_variation'); function ...
2
votes
1answer
681 views

Which hooks is this? add_action('wp',

I have seen it here: wp_schedule_event Code snippet: add_action( 'wp', 'prefix_setup_schedule' ); I couldn't find this hook anywhere in documentation, how does it work?
2
votes
1answer
73 views

Security around save_post hook

There are a lot of examples using the save_post hook, that include adding and verifying a nonce, and checking the user has appropriate permissions before you continue. Is this necessary? When ...
0
votes
3answers
43 views

register_deactivation_hook argument -> pass arguments in the selected function

I've been looking for minutes how to pass arguments in the register_deactivation_hook as follow : register_deactivation_hook( __FILE__, array( new Cpt, 'delete_cpt') ) ); class Cpt { /** * ...
2
votes
2answers
251 views

Add site options UI in Multisite Sites > Infos page

I want to add meta fields for the sites in my network (such as a thumbnail and a category). I know how to do this using get/add/update_site_option, but I'm wondering where I could put the UI to manage ...
1
vote
1answer
21 views

Howto check version of another plugin and then add a submenu page to it

i'm writing a plugin which requires another plugin. So i have to check first if the other plugin exists in a correct version. If yes i want to add a submenu page to the plugin page but here my code ...
0
votes
2answers
55 views

How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the save_post hook: add_action('save_post', 'assign_parent_terms'); function ...
0
votes
1answer
60 views

Hook into $wpdb

Is there a way to hook into the WPDB instance ($wpdb)? What i basically want, is to execute a own function BEFORE the desired query get's executed. Is this possible? Additional question for comment ...
0
votes
1answer
154 views

Ajax +wordpress onClick link redirect to new page and create html content

i have two pages in my wordpress plugin index.php charts.php in index.php i have some content and some link.. <a onclick="show_trend()" >Trend</a> while clicking this link ,i have ...
-1
votes
1answer
119 views

WooCommerce New customer email Hook? [closed]

I've created a sign up page for new customers to create an account. This is working fine but I would like to hook into WooCommerce customer_new_account inside ...
0
votes
0answers
19 views

Meta query not working with pre_get_posts

This works $q->set('meta_key', 'available-date_%_from'); $q->set('meta_value', '20140701'); This doesn't $q->set( 'meta_query', array( array( 'key' => 'available-date_%_from', ...
6
votes
2answers
6k views

Is there a hook that runs after a user logs in?

I am writing a plugin that fetches some extended user info from a remote service and I need it to execute its function each time a user logs in. Is there a hook that gets fired after login that I can ...
0
votes
1answer
24 views

How to hook watchdog script for existence of a WP page?

I would like to have a watchdog script which checks the (un)availability of a certain DB entry, namely a certain WP page. The script itself is absolutely independent from WP and not difficult, but I ...
2
votes
2answers
458 views

Run javascript code after wp_login hook?

After using the wp_login hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress? I want to use this top implement a notification system ...
0
votes
1answer
52 views

Removing action from template class

I'd like to replace an action in a theme with my own version in a child. In this case, the theme hooks into wp_head to add it's own links. My own functions.php resides in the child theme and looks ...
0
votes
0answers
15 views

check_admin_referer always false when I use on add_action('load-'* hook

I have try to add hook on load my plugin page. But every time i save my config, it always return "Are you sure want to ..." message. Is there something i missed? Here's my code: <?php class ...
0
votes
0answers
36 views

Using 'add_attachment' to add taxonomy term on upload completion?

function amend_gametitle_upload( $game_title ) { global $post; if ( isset( $_REQUEST['post_id'] ) ) { $post_id = absint( $_REQUEST['post_id'] ); $post_obj = get_post( ...
0
votes
1answer
41 views

Get new (not old) post inside transition_post_status hook

Following up the ticket 'transition_post_status' is executed before 'save_post', I'm still struggling how to access the new $post (after it has been saved) inside a transition_post_status hook. Right ...
0
votes
0answers
38 views

Checking if some condition is matched before inserting post into database

Is there a way to check if some requirements are matched before adding new instance of custom post type to database? Like custom policies for adding new posts etc? What I want to do is to build two ...
2
votes
1answer
219 views

How and why can a hook call itself without causing recursion?

When looking in WP hooks' code, I often see hooks that call themselves. For example, this snippet from image_downsize(): function image_downsize($id, $size = 'medium') { if ( ...
1
vote
1answer
133 views

Move excerpt meta box to above content editor

I found a WordPress hook called "edit_form_after_title" to add a text box after the title. How can I use this hook to display the excerpt after the title while creating a new post?
0
votes
0answers
15 views

Ask for template when adding a new page

I would ask the admin which template they would like to user when they click on "Add New" Page. Is this possible? I think I have seen something similar before where it ask you how many columns you ...
0
votes
1answer
47 views

Dynamically Generate Functions and Hooks

I'm trying to find if it's possible to dynamically generate functions and hooks. All functions do the same thing, and all hooks are essentially the same. Here's an example of a hook/function combo: ...
0
votes
0answers
37 views

get_plugins() doesn't work after plugins_loaded

Any idea why the following code function my_plugin_load() { get_plugins(); } add_action( 'plugins_loaded', 'my_plugin_load' ); Throws this error? Fatal error: Call to undefined function ...
0
votes
1answer
17 views

Hook on creating a menu entry?

I need to run some code after a new item has been inserted into a WordPress nav menu. Is there any hook on menu modification or something similar?