Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

1
vote
0answers
57 views

Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied

When I load the content using ajax it doesn't apply MediaElements.js to my audio player, so the audio isn't display. I think this is because the MediaElement.js is loaded with wp-footer(), and this ...
1
vote
1answer
57 views

How to add theme support?

I figured this would have been a question already, but I haven't come across it. I'm wondering what the correct hook for checking theme support is in a theme and also a plugin. function ...
0
votes
2answers
252 views

In WooCommerce I need to modify the thankyou.php page [closed]

In the thankyou.php template there is an action showing the section marked in red in the image. The problem is the caption/title "Our Bank Detals" should be above the description not beneath. The ...
0
votes
1answer
54 views

How can I check user capability when a page loads (via functions.php)?

I need to restrict users without a specific capability from seeing a specific page. I can't use shortcodes or anything like that, I just want to redirect them if they get to that page URL. I want to ...
6
votes
1answer
152 views

Does hooking into the same action multiple times drain memory?

Currently I have three functions that run on pre_get_posts. I call them like this: add_action( 'pre_get_posts', 'private_groups' ); add_action( 'pre_get_posts', 'search_results' ); add_action( ...
0
votes
1answer
34 views

Plugin: Hooking up classes that have their own hooks

Was wondering if there is a "best" approach to hooking up classes that has their own hooks, still making sure that those hooks haven't run before the class got a chance to declare it's own said hooks. ...
1
vote
1answer
45 views

I don't understand why I shoud use lostpassword_url hook?

Look into my comment in the code below: // WHY can I not just do this? class Customuser { public function __construct() { // Using this when using lost password functionality ...
0
votes
1answer
41 views

How to check which submission button was clicked?

So I added a new submission button to the edit page: Using the post_submitbox_misc_actions hook with the submit_button($text, $type, $name); function. I wanted to modify the data that's saved based ...
0
votes
1answer
53 views

How to get the postID inside 'content_save_pre'? Other hook?

I need to get the current PostID. I think in the function the postID is not existing yet. (Because save pre ...) add_filter('content_save_pre', 'getImageUrlOutOfContent', 10, 1); Am I right? How I ...
0
votes
1answer
92 views

WooCommerce: Add Payment Gateway Field to Webhooks [closed]

I have created a custom Payment Gateway for a special EFT system we have setup. The Bank Account and Routing Number are supposed to get encrypted then sent to a Salesforce via the WooCommerce webhooks ...
1
vote
1answer
108 views

Create a plugin to change the action to which a function is hooked

I have a plugin that hooks a function on to the woocommerce_before_my_account action. I would like instead for the plugin to hook that function to the woocommerce_after_my_account action. If I ...
0
votes
1answer
44 views

How to use the post_updated hook before and after arguments

I want to check if the title of the post has changed and do some stuff if it did. I thought of using the post_updated hook, the codex says "Use this hook whenever you need to compare values before ...
0
votes
1answer
212 views

how to make custom ajax handler?

i'm trying to make custom ajax handler because the admin-ajax.php is taking to long to handle ajax requests from 7s to 10s so i google it and mange to do some custom ajax-handler.php like this ...
-2
votes
1answer
45 views

Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]

Hi is it possible to make an extra field in backend, when orders are selected and marked as shipped then an extra field come and where i can select drivers who are responsible for this shipped order ...
0
votes
0answers
28 views

plugin development for woocommerce

i create this plugin: A discount in % for woocommerce price, but i have a problem: add_action( 'woocommerce_product_options_general_product_data', 'crele_add_custom_general_fields' ); add_action( ...
0
votes
0answers
19 views

How to add new tab and data in Wordpress Users section

I have to add new tab and new data in wordpress users. Please see the image below. The points tab came from the plugin mycred but i don't know what was used. What I think was it was done using: ...
0
votes
0answers
22 views

Execute code only after user clicks 'update' button for CPT being edited

In my plugin, my custom post type posts might be updated either by a user clicking 'update' on the editor page, or programmatically. I need to execute a settings validation routine only when the ...
0
votes
1answer
73 views

Add action hook into wp_localize_script

Is it possible to add an action hook via wp_localize_script, so I can position where I want the hook to run in HTML markup that is made in the JavaScript? So something like: $data = array ( ...
-1
votes
1answer
24 views

The acction hook stop working if i move it from plugin file to theme's functions.php file

A bp_includes is buddypress action and hooked on plugins_loaded function remove_bp_docs() { global $wpdb; $current_user = get_current_user_id(); //We are selecting member type before ...
-1
votes
2answers
66 views

How can I add a custom meta value on file upload?

I am looking for an option where a custom meta value will be saved when user uploads an attachment. Lets say I need a meta key _example_meta_key and want to save meta value of this as ex087659bh (It ...
2
votes
2answers
45 views

How often do you need to register_post_type?

Assuming you write a plugin and hook into activation / deactivation to register_post_type is that good enough? Or do you need to do it every init? I'm looking for perf boosts and I want to reduce ...
0
votes
3answers
82 views

Which action hook should I use to intercept a form upon submission?

I have a form on wordpress page with a POST method. I need to add an extra field to the form after submission but before it is sent to the URL in the action attribute. I was thinking to use an ...
0
votes
1answer
44 views

How to replace default comments with custom HTML?

I'm going to replace default list of comments and comment form with Facebook's comment box. As far as I know there is function wp_list_comments(). How can I replace this function with my custom one? ...
5
votes
2answers
219 views

Add custom html to last sub-menu item

I'm adding a custom menu to my wordpress theme. I need to add custom html to the final submenu item - before the primary sub-menu closes </ul> I have registered my new menu //functions.php ...
1
vote
1answer
221 views

Gravity Forms - Using a Form to Pre-populate A Gravity Form

I have a custom form (hardcoded, not a GF) on one page I've written myself: <form id="tailor-select" method="POST"> <ul> <li> <ul> ...
1
vote
1answer
24 views

How do I add a checkmark to my-sites save settings hook

I want to add a checkmark to the my-sites.php through a hook and then press save settings and have it do a function that executes a SQL query. I've added the checkmark but I don't know how to go ...
2
votes
1answer
170 views

Removing labels and <br> tag on WordPress's default login form

I am customizing the login form to more closely resemble Google's minimalist form, which has no form labels, and instead relies on placeholders to prompt users for the input fields. The form starts ...
-1
votes
1answer
29 views

How do I add functionality to images?

How would I add functions to images? I host a photography site, in which I'd like to add options to favorite an image or attach it to a product for ordering. Is there a hook or something that I can ...
0
votes
0answers
64 views

On WP 4.4, how to get the post id on comment_post hook

Since WP 4.4, seems like is not possible anymore to use get_the_ID() or the_ID() when hooking on comment_post action. How can I get the post_id when a new comment is saved?
0
votes
1answer
51 views

Remove Permalink From Admin Edit Post

Is there any way how to edit the title field in post.php? this field: I want to remove the permalink part but I wasn't able to find any hook or filter for it.
0
votes
0answers
242 views

Woocommerce: trigger new order email without changing status

We are working on trying to process phone pledges for a non-profit where the payment is not received and will be invoiced. I have a custom checkbox field in the Woocommerce admin, when checked, I ...
0
votes
1answer
26 views

Run only on plug-in activation instead of wp_head

I have below function on my plugin which adds more capabilities to current user. // Role setting for add media function wh_edit_roles(){ if ( current_user_can( 'edit_posts' ) ){ $user = ...
0
votes
1answer
99 views

$_POST empty in using new php file added to theme

I am using a theme which handles form data with jquery (a handler function defined).I have added a new php file to theme (using it in as template in a wordpress page, also registered with rewrite ...
0
votes
2answers
64 views

How to distinguish on hook profile_update user registering, user resetting password or user updating profile?

The hook profile_update gets fired in case the user updates his profile, that is also when he reset the first time his password after registration and when he register. How do I distinguish ...
0
votes
1answer
53 views

Passing variable in hooks and filter

I was trying to pass variables in filtes. This works perfectly for me. class my_class { function my_class() { add_filter('wp_list_categories', array(&$this,'cat_count_span')); } function ...
0
votes
1answer
30 views

Passing link parameter values to form

I've added edit|delete options in every row of a table, created in the admin panel. function column_A( $item ) { $actions = array( 'edit' => sprintf( '<a ...
1
vote
1answer
156 views

How to change post status from publish to draft using hook in wordpress?

I want to change the status of already publish post to draft using its id. add_action( 'save_post', 'change_post_status', 1 ); function change_post_status( $post_id ){ $my_post = array( ...
2
votes
3answers
50 views

Getting my head round WordPress filter

I am following a tutorial that will hopefully allow me to insert templates straight from my plugin into WordPress. I am using the template_include filter, I can't get my head around how the whole ...
0
votes
0answers
40 views

How to resolve 500 error in post listing page?

I am getting a 500 error in only post listing page. I checked code in admin and found this hook creating a problem: admin_head-$hook_suffix When I remove this hook, page works fine. How can I ...
0
votes
1answer
22 views

Odd map_meta_cap $args on post edit — sometimes integer, sometimes string

I've been digging into the map_meta_cap filter since I need to extend the user's capabilities based on context, in certain situations. This is working well but in my traces I noticed something odd ...
0
votes
1answer
30 views

Customize title, description and focused keyword [closed]

I would like to customize focused keyword, SEO title and meta description, but I am unable to find any clue how to do it. There is official documentation but it is sooo lacking... I came up with ...
0
votes
0answers
39 views

wp query custom orderby not custom field

I am working on a products archive page where I show 20 products on each page with pagination. Each product's price is calculated by a formule which gets his parameters by data saved in the database. ...
0
votes
2answers
23 views

Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)

Here's a very simple plugin, which I drop into mu_plugins in my multisite installation: <?php /* Plugin Name: Test */ class myclass { function __construct() { error_log("I just ...
14
votes
3answers
2k views

How many times will this code run? (or, how rich is grandma?)

Hypothetical example but real world applicability (for someone learning, like me). Given this code: <?php function send_money_to_grandma() { internetofThings("send grandma","$1"); } ...
2
votes
1answer
58 views

Error when overriding only some audio shortcode HTML output

Context I have a function that overrides audio shortcode HTML rendering, thanks to a WordPress hook: wp_audio_shortcode_override I used it this way in an OOP plugin: add_filter( ...
1
vote
3answers
59 views

Trying to understand order and frequency of action hooks firing

I'm working on a plugin that modifies user capabilities and turns off a lot of things in the Admin pages. I'm having some problems with order of execution with my code, so I want to refactor it and ...
0
votes
0answers
40 views

Function Hooked on Init Running Multiple Times

I have a method that logs the users login time. public function log_login() { if ( isset($_COOKIE['current_visit']) ) { return; } // Get current user $user = ...
0
votes
1answer
35 views

Converting restricted html in comments to bbcode

Problem: Wordpress multisite only allows the Admin account to include images in html for security reasons. It is possible to install a plugin that turns off these restrictions, but it apparently opens ...
0
votes
1answer
32 views

WP Cron not executing after timespan

I trying to utilize wp_schedule_single_event to schedule an asynchronous task. However, my event was never called after 60 seconds. Do I need to do anything with ldp_new_topic_event hook before using ...
0
votes
0answers
25 views

Hooks after media is saved

Is there any hooks/filters that fires when user already uploaded image/video . Thank you