Tagged Questions

Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

0
votes
0answers
63 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
19 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
29 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
24 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
82 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
35 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
42 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
116 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
78 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
15 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
70 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
37 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
24 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
31 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
25 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
63 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
97 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
21 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
44 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 ...
1
vote
0answers
34 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
69 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
66 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
58 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 ...
3
votes
2answers
79 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
68 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
129 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
289 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
21 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
124 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
62 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
88 views

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

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 ...
0
votes
1answer
240 views

Hook after wp_enqueue_scripts

I want to perform action when scripts are loaded. I mean when scripts are enqueued i want to take some action. Is there a hook after_wp_enqueue_scripts?
0
votes
1answer
226 views

How To Get Search Term and Use in Function

I'm trying to write a function that will 'grab' the search term entered into the blog search form, and then hook the function to the get_search_query filter like this ...
0
votes
2answers
212 views

wp_ajax action is not running

I'm writing a plugin. I want to run the method get_my_option when someone pressing a button in the settings page of my wordpress plugin. The ajax call is made but the method never runs. In the page I ...
0
votes
3answers
383 views

How do I add some javascript validation to the admin interface form's onsubmit?

I have a plugin that adds meta boxes to the admin interface and I need to do some validation when the user presses the "update" button before the form is submitted. Is there a WordPress action or ...
0
votes
1answer
285 views

wp_trash_post action hook with custom post type

When a 'contact' cpt post is trashed, i need a metakey from another cpt 'act' to be deleted, i have been searching all over which hook i should use but unfortunatly the codex action reference page is ...
0
votes
0answers
36 views

Which hook to use to add notification message at beginning of my <body>

i want to add dynamic messages to the beginning of my but I can't figure what hook to use. I have tried get_header but i can't append content to it... any idea? I don't want a solution that requires ...
0
votes
0answers
117 views

Wordpress upload file action hook

I have a custom post type called "Magazine" shown in the admin interface. Everytime a user uploads a file in the wp-admin to my custom post type "Magazine", I want to fire a hook because I have to ...
0
votes
1answer
49 views

When is get_currentuserinfo() needed?

I know you usually call it inside functions after global $current_user, but sometimes it works whether you have it or not. So what are the conditions where is it needed? Sample code: function ...
0
votes
1answer
64 views

Gravity Forms | Form Object is NULL [closed]

I am trying to customize some gravity forms behavior. Therefore I've tried to hook into gforms from my theme. Unfortunately the form object is always NULL. Why is that the case? Example code: 1) ...
3
votes
1answer
27 views

Change text of Description in Image Library

i would like to change or add text to the Media Library Overlay on the right side if you click on an image and can enter a description for the image. At the moment there stands "Description" or ...
1
vote
1answer
83 views

Injecting a custom sql query into a page/theme

I have written a custom sql query for our WordPress website (fairly elaborate and not achievable with the standard wordpress code) and I've got it to run via $pageposts = $wpdb->get_results($query, ...
0
votes
2answers
133 views

jQuery does not work

I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong? ...
1
vote
2answers
553 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, ...
0
votes
1answer
42 views

Hook only specific post type

with this function I change the title of my posts in the posts type 'alternatives'. My problem is that Wordpress changes all my titles now. Does anyone know how I can set this for the specific custom ...
0
votes
2answers
104 views

Transition Post status not working

I have a plugin which uses the transition_post_status hook, to fire a custom function on post update. But I don't know why its not working. Here is the code add_action('transition_post_status', ...
1
vote
2answers
159 views

Hook to generate a dynamic sitemap with “All in One SEO Pack” Plugin

Besides the urls of posts, pages and categories, I need my site's sitemap to include the urls of various pages that display data coming from an external source other than the WP database (Rails API). ...
0
votes
1answer
47 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. ...
4
votes
1answer
211 views

Changing the “Plugin Activated” Message Default

Whenever an administrator in WordPress activates a plugin, upon the reload of the plugin page, a notice will appear upon successful activation reporting "Plugin Activated". Is there a way to change ...
1
vote
1answer
80 views

How to hook in after user's registration email has been sent?

I want to redirect to a page after the user's registration email has been sent. What is the correct hook? user_register is too early, that is the user is entered into the database but the email ...