Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

0
votes
1answer
26 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 ...
0
votes
1answer
21 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
59 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
37 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 { /** * ...
1
vote
1answer
19 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
30 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
39 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
58 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
30 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
13 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', ...
0
votes
1answer
22 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 ...
0
votes
0answers
10 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
17 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( ...
3
votes
2answers
134 views

Adding function directly vs using hook in function.php

We can use functions like register_nav_menu() directly in function.php and it works and we can also use a function to put register_nav_menu() inside of it and attach that function using a hook like ...
0
votes
1answer
24 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
23 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 ...
1
vote
1answer
207 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 ( ...
0
votes
0answers
14 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
30 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
24 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
16 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?
0
votes
1answer
24 views

Is there an action hook that fires just before a template is loaded?

I'm looking for an action hook that occurs just before a template is parsed but AFTER the query has run and the variables are present. So if it's going to run index.php, just before it starts reading ...
0
votes
2answers
8 views

How do I prevent term from being created on create_term hook?

I have a function working on 'create_term' hook, I'm trying to prevent the term from being created on certain situations, I've tried return false; But that didn't do much, how do I prevent the ...
0
votes
1answer
27 views

How to get menu location in wp_update_nav_menu hook

I want to get the menu location in the wp_update_nav_menu (during menu save action) add_action('wp_update_nav_menu', function ($id, $data = NULL) { error_log( var_export($data, true) ); ...
0
votes
1answer
22 views

How do I grab specific posts (by post id) and display the title, featured image, and excerpt?

I'm trying to help a friend get his site in order and he wants me to swap out the "services" posts on the front page with 4 specific posts. Thing is, I don't know the right way to do this dynamically. ...
0
votes
0answers
24 views

register_activation_hook not working with symbolic links

I'm writing my first own Wordpress plugin. It's working great so far, except that now I need to create a few DB tables upon plugin activation. So I put register_activation_hook( __FILE__, ...
0
votes
1answer
20 views

Which hook if user profile information is updated?

I'm looking for the hook that fires when a user's information are updated. Specifically, I want to update a post with the value of a custom profile field (in my example info) everytime that user's ...
0
votes
0answers
37 views

Get the menu name or location of current menu item

I am having a hard time trying to get the name of the active menu and, apparently, I cannot find any solutions to this issue. Basically, I have several menus that follow this pattern: Menu Name ...
0
votes
0answers
10 views

Edit default action for profile_personal_options

Is there a way to edit the pre-existing action attached to the profile_personal_options hook that is built-in to WordPress?
0
votes
1answer
37 views

Using actions, hooks and filters in a non-WordPress page

I have a php script that sits outside of wordpress, but loads WP core with wp-load.php. Here is my basic page: <?php define('WP_USE_THEMES', false); global $wp, $wp_query, $wp_the_query, ...
1
vote
1answer
18 views

how to customize rss feed tags using hooks?

My RSS feed is displaying an XML tag which I either want removed, or emptied. The tag in the XML looks like so: <wfw:commentRss>remove/this/uri</wfw:commentRss> I have never used hooks ...
0
votes
1answer
22 views

get categories the post was in and just been removed from

I have a function hooked to the save_post hook. this function is mostly concerned with the categories that the post is in. My function does the following: function post_save_hook($post_id){ ...
0
votes
0answers
17 views

How to hook new args into a Custom Menu Widget?

I am trying to add some code before the list items in a sidebar Custom Menu Widget. Maybe I'll add an image, maybe I'll add some text. Not sure yet. But I'm having a hard time trying to figure it ...
0
votes
0answers
14 views

How to get WP to run plugin code triggered by an external site hook?

I have written a plugin to sync data from a WP blog to an external website. Changes to made to the external site also sync back to the WP blog. Right now the external website executes a POST request ...
0
votes
1answer
29 views

Hide H1 Title using the_title filter

I am trying to hide the pages H1 header IF a custom field specifies this. On a page back end I have added a custom field: Name = hide_title Value = true I then want to hide only the H1 using a ...
0
votes
1answer
51 views

Display_rows() and column_cb() strange behaviour

I found a strange behavior of my functions. I thought to pass the id from display_rows() to column_cb(), but the problem is that the program passes only the first digit. Any hint? column_cb(): ...
0
votes
0answers
18 views

addaction hook cause redirection problem

I have added the hook in my wp functions: add_action('pa_taxname_edit_form_fields', 'woocom_edit_attribute_chk_field', 10, 2); function woocom_edit_attribute_chk_field($term, $taxonomy) { ...
0
votes
0answers
19 views

Customizing the built-in Media Playlist

I have a simple challenge I can't quite seem to make any progress on: Get the current track (or video) playing and display a link to a transcript of the song. This should be a simple task (and the ...
0
votes
0answers
25 views

PHP header() gives headers already sent

I am working on a checkout proces in Wordpress where if customer clicks on the checkout button he gets redirected to a payment provider. Important to know: I use a session in this proces. I use PHP ...
0
votes
0answers
46 views

Init hook for header send

I am working on a checkout proces where if I submit the checkout I get an error "headers already send" because I use a PHP header() function to send the customer to my payment provider url. My idea ...
1
vote
1answer
36 views

Plugin activation hook in an abstract class

I would like to create a common abstract class to use for every WordPress plugin that I develop. As a part of the class' initiation process, I would like to fire the activation hook which calls an ...
0
votes
3answers
35 views

Is it safe to register a taxonomy without using any hooks?

I'm creating a Wordpress site in which I wanted to use a custom taxonomy in my theme options, which I had registered using the 'init' hook. But the problem was that the 'init' hooks gets fired after ...
2
votes
2answers
29 views

What hook is executed just after wp_query has been executed?

What hook is executed just after wp_query has been executed? before template is rendered? I want to change the page title but it depends on what has been queried. I have put it in template_redirect ...
2
votes
2answers
35 views

What's the earliest point I can get the queried object ID?

I'm writing a supplement plugin to Wordpress Mobile Pack because I would like to use the default theme on pages that are assigned a certain page template. My plugin will only deal with the mobile ...
0
votes
2answers
88 views

Post curl function save twice using plugin hook function wordpress

when i save a data with my curl function using hook to save a data twice. public function __construct() { add_action('init', array(&$this, 'init')); ...
1
vote
1answer
98 views

Remove “Get Shortlink” button in admin of custom post type

I want to remove completely this section under my title in my custom post type. (I don't need this because I use this only for content management). With this piece of code I can remove the ...
0
votes
1answer
18 views

How to Show Different Information to your authors/contributers

One of the nice tricks that WordPress admins who have a number of authors/contributors could do to help them in writing content is to share with them relevant information based on where they are in ...
1
vote
2answers
86 views

Define custom Page Template without its own .php file

Is there any way of defining a Page Template from some function/filter/hook, without having any .php file containing the comment at the top of the page to declare the Template Name? For example, ...
0
votes
1answer
32 views

Where and how does WordPress store and use its plugin and hook information?

When WordPress installs a plugin, where does it keep the fact of a hook/plugins existence? For example, wp-includes/plugin.php I can see do_action, but I'm not familiar enough to know how WP loads ...
0
votes
1answer
50 views

Gravity Forms plugin: How to use “gform_editor_js” action hook?

I have a question regarding this action hook: http://www.gravityhelp.com/documentation/page/Gform_editor_js. I'm not sure where to put this action hook. Can I use this action hook in my child theme's ...