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

learn more… | top users | synonyms (2)

0
votes
0answers
11 views

multiple loops meta data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. ...
0
votes
1answer
20 views

how to add submenu item under parent menu item with code

Well, here is my problem suppose i have a menu like this generated by wp_nav_menu() home test- test1, test2 contact about test is my custom post type so what i want to do is if a user/admin ...
4
votes
1answer
17 views

Wordpress Multisite: Adding actions to only one site

I have Wordpress Multisite installed with WooCommerce network activated. I want to add an action to a hook in ONE of the sites that has WooCommerce installed, instead of all of them. For example, I ...
0
votes
0answers
14 views

Removing WP-Login inputs

I'm building a passive captcha system for my WP sites, and I'm attempting to remove the inputs (username, password, submit) from my standard WP-Login page via php hooks; they'll be replaced via jQuery ...
0
votes
0answers
17 views

Stop a specific plugin from executing based on product id in cart

I am trying to stop a specific plugin from executing based on product id in cart. However i can't seem to get it running. There are a few places where i want the plugin to stop inserting its function. ...
0
votes
0answers
21 views

Filter WP_Query output before it is accessed (pre_get_posts)?

I have read Using pre_get_posts with WP_Query and I'm not sure where to go with it. I have a recent posts plugin which adds variables to WP_Query - one of which can be 'offset' posts. The problem is ...
1
vote
1answer
22 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
0answers
15 views

WooCommerce Hooks - Rename Add to Cart and Move [closed]

I can rename the add to cart button with the following code: add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1 add_filter( ...
1
vote
1answer
24 views

How do I add Bootstrap and LESS to my migrated WordPress site?

I'm migrating a website to WordPress - it uses both Bootstrap and LESS. I found a snippet online for enabling Bootstrap and the outputted CSS via functions.php: function theme_add_bootstrap() { ...
0
votes
1answer
26 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
26 views

Custom CSS not being added by plugin

I am attempting to add custom css through my plugin. I do have wp_head() called in my header. My code is - /** * Enqueue plugin style-file */ function prefix_add_my_stylesheet() { ...
3
votes
1answer
28 views

How to validate XML-RPC post creation and cancel when needed?

I have an IFTTT recipe that creates posts for me on some occasion, but for some weird reason it creates three, sometimes four posts of the same content. I would like to add an add_action ...
0
votes
1answer
12 views

Is there any reason why there's no “login_header” action at the login page?

There is a login_footer action hook at the wp-login.php of Wordpress which is quite handy for strapping in the theme footer into the login/registration page: add_action( 'login_footer', function() { ...
0
votes
1answer
19 views

Overide enqueue in non plugable function via child theme

I am trying to override a non-plugable function using the information on this page but it seems to have no effect. Can anyone see what's wrong. My code is remove_action('wp_print_styles', ...
0
votes
2answers
27 views

Retrieve options set through a plugin

I am creating a simple "global settings" plugin, which simply saves a few text fields. Saving works as intended, and I can retrieve my data in frontend as follows: <?php $options = ...
0
votes
1answer
21 views

Insert Google authorship into WordPress header

I'm working on a custom plugin that creates courses and lessons within WordPress. Here's the page I'm trying to get Google authorship showing in: → ...
0
votes
3answers
47 views

Insert custom postmeta when custom post type published

I'm trying to populate the postmeta table with a custom value when a custom type ('my-solutions') is published. I've read a few threads, the Codex and Pippin's blog on this matter and tried many ...
0
votes
0answers
15 views

Autogenerated Title for Custom post type loses title when trashed/deleted

I am generating title for a custom post type using the following code. It takes the $fname, $mname, and $lname values and generates a title based on the post. This works fine for custom post creation ...
0
votes
1answer
17 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
2answers
25 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
0answers
14 views

What action is triggered when the plugin is installed?

What action is triggered when the plugin is installed? "wp_setup_theme" is other action :-(
0
votes
1answer
37 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 ...
0
votes
2answers
27 views

Why does my delete_post hook get called twice

Here is how I've implemented it: add_action( 'delete_post', array( 'MyClassName', 'delete' ) ); In the delete function I was using a $wpdb->insert command to see whether the function gets called. ...
2
votes
1answer
43 views

Including only current user's posts in search

I am a new WP plugin developer. I want the search page to include only the current user's posts. I first added a new capability read_others_posts to only administrators and editors. Then I tried the ...
0
votes
0answers
30 views

remove_filter right way

What is the right way to remove filter in condition? method 1 public function update_loop($query) { global $wp; if(!$query->is_main_query() || $query->is_admin) return; ...
2
votes
1answer
38 views

What's the best way to split admin-only functionality in the theme's functions.php file?

I am customising a Wordpress admin area and so far so good with a number of add_filter and add_action calls in my theme's functions.php file. But I'm a bit worried because all this code will be ...
0
votes
0answers
14 views

XML Imported Custom Posts

I have an xml feed populating a custom post type. I need the custom post type to add the first imported image as the featured image. I have come across the following function and adapted it: ...
0
votes
1answer
43 views

wp_logout action not working

I'm trying to remove some cookies set to control persistent login when the user specifically wants to log out of a website. I thought it would be as simple as: function remove_user_cookie() { ...
0
votes
1answer
18 views

Hook into 'when user logs in' [persistent login]

I'm trying to create a persistent login mechanism in Wordpress (I can't find a plugin, but if there is one, let me know!). But I'm struggling to find a hook (add_action or add_filter) that runs when ...
0
votes
1answer
36 views

override function from my plugin [closed]

can anyone guide me how can I override following function from my plugin. I know how to use add_action but I didn't found add_action for this function in buddypress plugin. Its using do_action and I ...
0
votes
2answers
70 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
40 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
17 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
61 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
31 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
38 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
15 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
33 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
22 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
35 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
39 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
26 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
12 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
48 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
34 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
34 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
26 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
86 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
12 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
58 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 ...