A name for an event that is executed at specific points throughout the WordPress core.

learn more… | top users | synonyms (2)

0
votes
2answers
138 views

remove_meta_box for all post types doesn't seem to work

To remove a metabox from all post types at once, using a foreach seems like the logical thing to do. However it doesn't always work and I don't understand why. For examlple viewing the "Post" post ...
0
votes
2answers
81 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
0answers
19 views

Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do ...
0
votes
1answer
169 views

Action hook “wp_insert_post” works but not for last imported post

I want to run a custom function whenever posts are imported to my custom post type. I am currently running this code - function on_post_import($post){ global $wpdb; $results = ...
0
votes
1answer
45 views

Loading plugin text domain before registering post type

I'm building a wordpress plugin, that will register a post type. Im trying to set up a simple test case where all it does is registering a post type with get text functions and translating it with ...
1
vote
1answer
48 views

$GLOBALS['hook_suffix'] variable empty

I'm trying to implement the code to add a custom post status from my plugin, exactly as given in this tutorial: http://jamescollings.co.uk/blog/wordpress-create-custom-post-status/ Now, it isn't ...
0
votes
0answers
23 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
59 views

Hook into admin_notices after sending mail

In my (admin) plugin I want to display a message using admin_notices action on successful sending of mail. Currently it is not displaying. I know this has something to do with the order of events, but ...
0
votes
1answer
54 views

Using a private method as an action callback from within a class

I have created a class from within which I would like to call a private method (from within the same class) from the __construct method as an action callback. When I would like to use a public method ...
0
votes
1answer
57 views

conditionally load javascript & CSS for do_action() calls from plugin

I am developing a plugin and using do_action() instead of shortcodes to display plugin content on the site. The plugin will only be used by me, but I am making the plugin to separate components of ...
0
votes
3answers
58 views

How to apply action the_post to the post that is only being mainly displayed

I'm trying to write an action that will modify some WooCommerce product on its display. This is my simple code function do_some_modifications($post) { if (is_singular('product')) { // do ...
0
votes
1answer
28 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
20 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 ...
2
votes
1answer
72 views

Enforcing password complexity

We need to enforce password complexity in a wordpress site, we used this article: http://www.webtipblog.com/force-password-complexity-requirements-wordpress/ We created the following in ...
0
votes
1answer
37 views

Invoke a function before the action hook

I want to invoke a function before a special action. I want to validate the input of a custom metabox (or custom field) before the changes are saved. If the input value is invalid, then a stop save ...
0
votes
1answer
67 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
0answers
40 views

Wordpress Unit Testing cleaning up hooks and filters

Using Wordpress' unit testing suite has been going quite well, and it's nice the WP_UnitTestCase takes care of cleaning up table data after each unit test. But one thing that doesn't seem to be ...
0
votes
1answer
211 views

Ajax - Call to undefined function get_option()

So I've been working in Wordpress lately with Ajax and I managed to get some stock data into my site from my database. However, I am now trying to use Ajax to load Wordpress posts into my left ...
0
votes
0answers
15 views

Presetting the link of video attached to a Standard Post Format in a custom field

I am trying to create a function that presets the URL (of an attached video in a Standard Post Format) to a custom field when the post is created using a front-end form. (P.S.: All data inputted in ...
0
votes
2answers
94 views

Remove/Unregister or hide a widget added by a plugin

I'm trying to figure out how to remove wordpress widgets added by plugins. I know there are a couple of plugins that do this, like https://wordpress.org/plugins/wp-remove-widgets/ and ...
0
votes
0answers
14 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
60 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, ...
0
votes
1answer
77 views

Include php on a specific page template

I'm using a 'specialized' page template called 'page-courses.php', following the codex: http://codex.wordpress.org/Page_Templates#Specialized_Page_Template In my child theme's functions.php I want to ...
0
votes
0answers
20 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
1answer
23 views

Can't Get Metabox Data Saved Assistance Needed

I'm trying to create meta box on a post create/edit page. I faced the problem: 1. When I create a post from scratch the data from my meta box is saved as expected 2. When I try to update an existing ...
0
votes
2answers
84 views

Create new custom post and post category of same name

I have a custom post type "Product" and want to create a post category "A Product Name" automatically on creation of a new Product so that the post category (not custom post category) would have the ...
3
votes
1answer
96 views

Using hooks to place content in theme dynamically

Alright, so I think I may be getting a little too complicated on this, but I basically want to know if this is possible. I am using a content slide function where I display some thumbnails within the ...
0
votes
2answers
464 views

Wordpress Update Plugin Hook/Action? Since 3.9

I've researched this a few times, yet my searching does not reveal much except custom code which may or may not be good wordpress practice. As of the latest releases, has a hook been added to the ...
0
votes
1answer
101 views

Return a custom value in a function added to an action hook

I looked into the difference between action and filter hooks, and as far as I understand, it is not possible to have a function, which is added to an action hook, return a (custom) value. My ...
0
votes
1answer
29 views

add_media_page function not creating submenu

I have the following plugin that I'm just testing at the moment. /* Plugin Name: Menu Test Plugin URI: http://codex.wordpress.org/Adding_Administration_Menus Description: Menu Test Author: Codex ...
0
votes
2answers
408 views

missing argument 2 when passing arguments to add_action

I wanted to pass arguments to a function triggered by an add_action hook. I followed the codex on this. I got a warning and the result was erratic, with an unexpected behavior. This question has ...
0
votes
0answers
63 views

Wordpress admin WP_table_list show incorrectly

As the image above, my custom wp_list_table didn't show correctly. Code as below <?php if ( !class_exists( 'V2OMLVG_Video_Table' ) ) { class V2OMLVG_Video_Table extends WP_List_Table { ...
0
votes
1answer
29 views

A question about add_action()

I was following this ( http://codex.wordpress.org/Plugin_API ) tut on codex. The part where a class is created and is called in add_action. No argument was passed to emailer::send ? Why? It was ...
0
votes
2answers
74 views

Extracting the post_id via the wp_insert_post action (external db query)

i'm writing a little action plugin. everytime a new post is created, a new table should be created in an external db. The name of the table sholud reflect the post_id of the newly created post, but i ...
2
votes
2answers
62 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
0answers
76 views

External Script Using WP - Hooks / Actions Not Working?

I've researched this problem in depth, but still stumped. Simply stated, I have an external uploader script which loads WP. Yet I cannot seem to grab any of the actions/filters I've put into it. Why ...
1
vote
1answer
235 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
78 views

New checkbox in custom widget isn't saving data

I'm trying to develop my own widget. Mostly cause I want to understand Wordpress functionality (yes I'm completely new. First ever try to extend wordpress) I want to add a function to display post ...
0
votes
1answer
31 views

Returning or use form data using a hook?

I have built a plugin that allows a user to submit forms to a third party API via an API call. I'm wondering if it's possible to add in a hook right before (or after) the data gets sent to the third ...
0
votes
0answers
91 views

using media_handle_sideload() to add mp4 files to Media Library

For a site I'm building (for a client), I've written a shortcode, where the poster can enter [vine id="..."] followed by the ID of a Vine video. When the post is saved, my PHP functions will then go ...
1
vote
0answers
109 views

How to customize the “Insert/edit link” popup box?

is there a way to customize the "Insert/edit link" popup box in the editor so that it does something like this: Have a checkbox that says "Insert affiliate tag at the end of link" If the checkbox is ...
0
votes
0answers
41 views

Expire a post with meta_value after two weeks

I am trying to use the below code to query for some posts and then change a meta_value in order to "expire" it after two weeks time. I can't get this to work and it's difficult to test since I can ...
0
votes
2answers
168 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
293 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
68 views

save_post action not firing when save

Below is my code that will take the post_id and randomly get 3 posts from the same category and store them as custom field. The code is clearly working, because when I click "New Post", I see the ...
0
votes
1answer
218 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
111 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 ...
1
vote
1answer
47 views

array of objects to do_action, callback gets singular object?

So I was passing an array of objects through an action today, no biggy, and things were working fine. Until I was iterating over one of the arguments to a callback and started getting errors. The only ...
0
votes
1answer
46 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
30 views

Redirect after post deleted

On the single template, I am using a delete post link generated by the get_delete_post_link function. When I use the link to delete the post I am currently on, it adds a query string of ...