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

learn more… | top users | synonyms (2)

0
votes
1answer
14 views

action future_post returns wrong date

Hi I am using a future_post hook to capture when a scheduled post is updated like so : add_action('future_post', 'on_post_scheduled'); Then I want to send the new post date to a database, however ...
0
votes
0answers
11 views

Trigger needed when meta data is updated

I need to update a MySQL table (not any of the WP/Woo tables) when a products meta_key "_stock" is modified. The trigger needs to fire on all updates: shop sales, a CSV merge or edits by admin in the ...
0
votes
1answer
33 views

Trying to use add_action and do_action with parameters

In my themes functions.php I trying to add a function with parameters (as a test if this works, not for the functionality) and it simply doesn't work. The parameters always arrive empty even if I ...
0
votes
1answer
14 views

How To Get User Data in Callback Function for pre_user_nicename?

Whenever I update a user profile in the dashboard, the user nice-name gets changed in the database: Every time, a "-2" is added. I tried to reset the nicename (based loosely on this thread) by ...
0
votes
3answers
44 views

How to use return in my custom function instead of echo

I'm creating a function in functions.php with a custom hook, and from what I've read somewhere, it's good practice to return instead of use echo in a WordPress function? Correct me if I'm wrong. ...
0
votes
2answers
31 views

Trying to write a function in an external php file to manage admin menu visibility

I am loading my php file by putting this into my theme's functions.php: require get_stylesheet_directory() . '/inc/manage-menus.php'; alter_menu('my-user', 'plugins.php', false); The code in ...
1
vote
0answers
36 views

Having an add_action( 'user_new_form',)

I am using the following action; add_action( 'user_new_form', 'epx_add_user_form_to_admin_area',489); function epx_add_user_form_to_admin_area($current){ $current .= 'this is a test'; echo ...
0
votes
1answer
12 views

Never actually adding the action? Or do I have to call the action?

I have the following class that is instantiated in the function.php file. In the constructor I am setting up a activation and a deactivation hook for the theme. How ever neither seem to be called when ...
0
votes
3answers
40 views

Add action to fire when a published post is updated

I have a couple of actions setup: add_action('publish_post', array($this, 'newPost'), 10, 2); add_action('post_updated', array($this, 'updatePost'), 10, 3); When I update an already published post ...
0
votes
0answers
8 views

Setup lazyload on post images using get_image_tag

According to jQuery.lazyload any images I'd like to "lazyload" need to have the src attribute replaced with data-original. I'm assuming I can do this using WP's get_image_tag filter, but I'm stuck on ...
0
votes
1answer
31 views

Can a plugin add to header/footer/body content?

I am just wrapping up my first WordPress plugin and the last thing I would like to do is take a piece of data that the plugin knows about (from wp_options table) and display it in either the header or ...
0
votes
0answers
22 views

do_action filter function from add_action array

I am looking at the following setup: -- Combing multiple functions into single action -- add_action( 'single_post_meta_start', array( $this, 'the_title' ), 10 ); add_action( ...
0
votes
1answer
21 views

Getting error while trying to use custom comment function

I'm trying to write a function that will allow me more control over the display of comments on a post page. However I'm confused about how to set it up so WordPress can use it. right now I get the ...
0
votes
1answer
35 views

Use external link in the add sub menu

I want to show the data in the external plugins.php file. the below url path is correct but its not showing the file data. Whats the problem? add_submenu_page( 'antify', 'Plugins', 'Plugins', ...
0
votes
1answer
25 views

Plugin Development - Functions or Hooks?

I am brand new to WordPress plugin development and have a few questions, mostly about best practices but also some specifics. Essentially I just want to trigger an action (invoking a PHP class and ...
0
votes
1answer
71 views

add_action and remove_action if custom field exists

I know this may be off-topic as it has to do with Genesis (a premium framework), but with general WordPress, this has to do with running a remove_action and an add_action depending on if a custom ...
0
votes
1answer
21 views

Problem in using Customizer

Looking for some help with a customizer problem. I am using following codes to create a customizer which will allow me to upload an image for topic of the week section. owever, the following codes ...
1
vote
0answers
23 views

Add custom buttons with custom actions in Edit Post screen in WordPress?

I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...
-3
votes
1answer
39 views

Which action/filter can i use for a Member Plugin [closed]

I'm a beginner in Wordpress Plugin development. I want to write a Plugin for a Member Part on my Page. I know, that Plugins for this Problem available, but i want to create an own Plugin ;) I want to ...
0
votes
0answers
15 views

Write Custom Access Control Code For WordPress Download Manager

The WordPress Download Manager plugin by default allow us to select which rule can access the file. But I have a special case, I want if the user have a meta date equal to specific value then the ...
0
votes
1answer
36 views

Problem with custom function when I go back with the browser

I have a custom function inside functions.php to show the typical social media buttons for each post listed (last entries, categories and tags pages): //Social Media function showSocialButtons() { ...
5
votes
2answers
109 views

remove_action on after_setup_theme not working from child theme

I am trying to remove a theme action for an elegant-themes theme using a child theme.. This works when I remove action after add_action code anywhere in the parent theme functions.php. However, it ...
1
vote
1answer
27 views

Any hook for pre-plugin-update -either bulk or single plugin update

Any hook is available on before the plugin update action ? i searched in hooks library . What is the exact hook? . Doing some stuff before updating plugin/theme .
1
vote
1answer
34 views

Namespaced action and filter tags

I'm upgrading several of my plugins to use PHP namespaces, so that functions, classes, constants etc are all namespaced correctly. <?php namespace my\plugin; function init() { ... } // ...
0
votes
1answer
11 views

strange behaviour of template_redirect in IE8

I have implemented page not found with a custom template and used template_redirect for it. add_action("template_redirect", array($this, "redirection_section"), 11); Now everything is working fine ...
0
votes
1answer
28 views

remove_action: Initial attempt failed while a later attempt worked

I hope this is the right place to post this - if not, please just simply direct me to the right place! I recently came across a plugin that, among other things, added a meta entry to the header. I ...
0
votes
1answer
16 views

Settings in functions.php used by a plugin

I'm writing a simple plugin and want some settings in an array in the functions.php file. I'm thinking of adding this in the theme functions.php $test = array('haha' => 'hehe'); my_function( ...
0
votes
0answers
19 views

Exists filter or action that change Add New Post link?

I want to know if exists some method from filters or actions to change the link of the Add New button in backend , for example the regular url is http://wordpress_install/wp-admin/post-new.php but I ...
0
votes
0answers
24 views

How add style in wp after main theme style.css

I try add style via plugin which should overwrite main theme style.css I use this code but it is not help me. function css() { wp_enqueue_style( 'css', plugins_url( '/css/style.css', __FILE__ ...
2
votes
0answers
23 views

How can I invoke an action after a CiviCRM triggering event?

If I want to have a certain action taken after a CiviCRM 'trigger', what is the best approach? I'm a Drupal developer used to using Drupal workflows on CiviCRM actions, and I am unfamiliar with ...
0
votes
1answer
20 views

Accepted arguments value in hook functions

Let's say I have the following hook function: function my_function() { $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : ''; if( !isset( $_REQUEST['mode'] ) ) $_REQUEST['mode'] ...
0
votes
1answer
47 views

How to use conditional add_action for Wordpress

I am having a small issue where i need to call add_action method which is conditional. Basically here, first checking whether the plugin active or not by admin_init action. If true then i need another ...
0
votes
1answer
44 views

Please explain me what the do_action does

I am trying hard to understand do_action but not understanding. I was studying the blane theme. And they have this code in sidebar.php <div id="secondary" class="widget-area col-md-3" ...
0
votes
0answers
29 views

Hooking action once but called twice

class GridModSidebars{ public function init(){ add_action('widgets_init', array($this, 'registerSidebars'),20); } public function registerSidebars(){ $args = array( 'name' ...
0
votes
1answer
57 views

Disable sanitize_file_name on upload without modifying functions.php

I am looking for a way to disable sanitize_file_name function without modifying the functions.php or formatting.php. I am uploading files that have other language file names and all I am getting are ...
0
votes
0answers
17 views

Override an advanced custom fields action callback [duplicate]

I'm in the process of writing a CDN plugin for WordPress and am trying to integrate it with the Advanced Custom Fields plugin. I need to filter the output of the "File" field type on the edit post ...
0
votes
0answers
19 views

Removing menu item doesn't get removed on edit post

I have removed some menu links for a basic contributor role, just that when the user access the edit post section they re-appear(wp-admin/post.php?post=24731&action=edit). What am I missing? This ...
0
votes
0answers
46 views

Custom search fields and AJAX support

I am trying to rewrite the search. I used the action pre_get_posts and the filters posts_where and posts_join. The page loads with my custom filters. But I can't make it work with AJAX. How can I make ...
0
votes
3answers
83 views

Why is my css and js not enqueued until footer?

add_action( 'wp_enqueue_scripts', function ( ) { global $post,$pageparent; if(in_array($pageparent, array($post->ID,$post->post_parent))){ wp_enqueue_style( 'products_pages', ...
2
votes
0answers
72 views

Auto Load Plugin Hooks inside Must Use Plugin

I am creating a custom MU plugin to run on a multi-site network. I am working on a function that will dynamically include files containing additional action and filter hooks based on the active ...
0
votes
1answer
51 views

What is the callback sent to add_submenu_page() invoked by WordPress?

WordPress tries to be event driven with all it's actions and filters you can hook to. But it also has special functions to create admin pages such as add_submenu_page() which accepts a (callback) ...
0
votes
0answers
22 views

If Specified Page then Redirect Elsewhere in Plugin

There's a few parent pages that only exist for URL purposes, but the actual page themselves need to be redirected to the home page since they're blank. I'm trying to make a simple plugin that will ...
3
votes
3answers
407 views

wordpress hooks run sequence

What is Wordpress HOOKS execution consequence? I mean, i want to know the order, how add_action hooks are executed (i.e. init after_theme_setup wp_header and etc.. i want to know the correct ...
0
votes
3answers
49 views

wp_ajax action responds with 0

I'm writing a plugin. There is a button, that triggers an ajax-request to an action I added in my plugin page: Head of my plugin PHP file: add_action('wp_ajax_update_nav_items', 'update_nav_items' ...
0
votes
2answers
66 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 ...
1
vote
1answer
89 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
34 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( ...
2
votes
1answer
41 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
24 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
32 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 ...