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

learn more… | top users | synonyms (2)

0
votes
2answers
20 views

Call Web Services on post first publish

I want to call some web service when i publish a post. I want to add a checkbox so as to decide whether to call or not call after publishing. I have found the code to call both REST and SOAP web ...
0
votes
1answer
42 views

Overwrite or Replace code in WP_Footer

I have a some code being dynamically added into my Footer via add_action('wp_footer' ...). Unfortunately I'm not sure how to remove it using conventional methods, I've looked at the following question ...
1
vote
1answer
30 views

Is it acceptable to treat a filter like an action?

The wp_insert_attachment_data filter is available inside wp_insert_attachment(). It allows attachment post data to be filtered before it is updated in or added to the database. $data = apply_filters( ...
1
vote
1answer
16 views

How to add a checkbox inside the “Publish post” widget?

I'm building post to email plugin and I need to add a checkbox to the publish post widget like this one: My idea is to add a checkbox that says "Send this by email", and get that info inside the ...
0
votes
1answer
23 views

At what point during a typical request does the $wpdb object become available?

I've wrote some custom SQL queries inside a class method and noticed they seem to work if I hook the method to the wp action. If I hook to the plugins_loaded action, they don't seem to work. My ...
0
votes
0answers
11 views

attachment custom values are'nt inserted to database

I have created attachment custom field. After I uploading image and inserting to new-post.php (post creating window) no meta values are saved in database. Even that I have set a default value for ...
0
votes
1answer
16 views

A good hook to check authorization and redirect?

It seems strange to put a redirect in a template page, because so much of the page has already been built by the time you reach a custom page template. I'm wondering what is a good action hook to use ...
0
votes
1answer
21 views

Adding to an array & passing it through do_action/apply_filters

For exercise I am working through a PHP class to add meta boxes I found on GitHub. I just copied the code and now I am playing around with it to understand it. It works like this: The file ...
0
votes
1answer
20 views

Manually add admin bar

Does anyone know how to include the admin bar in a page template where wp_head() and wp_footer() are not present? I'm developing a template other scripts and styles are just getting in the way. Rather ...
0
votes
1answer
23 views

Add Different Actions To Different Page's wp_footer

I am trying to add functions to wp_footer based on the the page id. I am hooking my callback to init, but its not working. Here is what I am using. function fl_template_loader() { if ( is_page( ...
0
votes
1answer
23 views

Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?

I'm trying to use author meta data to automatically populate a custom taxonomy on a given author's post(s). Currently, the taxonomy is visible on the post page, but I intend on hiding it from the ...
3
votes
1answer
47 views

Autogenerate wordpress shortcodes using array?

I was create a shortcode which automatically generate shortcodes with given array key and value. Function names does not generate dynamically. Note: Array KEY = ShortcodeName and Value = Wordpress ...
3
votes
1answer
77 views

Deactivate plugin for a specific user group

I would like to deactivate a plugin for a specific user. I'm using the following code inside a the wp-content/plugin-mu plugin file: add_filter( 'option_active_plugins', 'bo_disable_apm_plugin' ); ...
2
votes
2answers
50 views

How to make post and comment count unclickable with dashboard_glance_items hook

I have a multi author site and I have already used some hooks to stop them from viewing other author's posts and media. Now, in the Wordpress Dashboard in the "at a glance" section it shows them the ...
1
vote
0answers
39 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. ...
1
vote
1answer
38 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 ...
5
votes
1answer
35 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
16 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
24 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
28 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
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 ...
1
vote
1answer
33 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
29 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
28 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() { ...
4
votes
2answers
43 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
14 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
30 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
22 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
73 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
17 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
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
2answers
29 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
46 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
34 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
50 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
32 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
39 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
15 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
62 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
23 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
46 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
98 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
60 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
107 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
39 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
46 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
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', ...