Skip to main content

Questions tagged [callbacks]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

Problem with inline style CSS properties issue on DIV

I am building a custom dragable interface where user can build form and drag elements. I am facing issue with inline style properties. The example html is given below $content = <div style= "...
iZeshan's user avatar
  • 101
1 vote
1 answer
30 views

Trouble with WordPress Settings API: Form Submits When Fields Called Directly, Fails When Using Callbacks

0 I'm working on a WordPress plugin and facing an issue with the Settings API. I have a settings page with two forms. The first form uses do_settings_sections() to call fields from a public function (...
user2765920's user avatar
0 votes
1 answer
23 views

I need help with this error [duplicate]

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'uthan_preloader' not found or invalid function name in /home/u815400924/domains/jardineschapa.com/public_html/wp-...
Luis Dias Santilhano Lopez's user avatar
1 vote
0 answers
14 views

Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week

Newbie to Wordpress and PHP! Every Monday, my task is to create one post (let's call it summary) in a custom post-type called "news". In summary, the "contents" field will be a ...
satoshi's user avatar
  • 11
0 votes
0 answers
197 views

Callback API for getting response from fygaro payment gateway

I am using fygaro payment gateway. On successful payment , I am getting json response from fygaro on fygaro's domain itself. But on successful payment, I want to store some data in database for that ...
Neha Thorat's user avatar
1 vote
1 answer
159 views

Gutenberg: How to check if a block is used in a paginated post?

There is the render_callback of the register_block_type function. In this callback, I can use add_filter('render_block', __NAMESPACE__ . '\\filter_block', 10, 2); filter_block iterates through all ...
Marc's user avatar
  • 717
0 votes
1 answer
74 views

Add parameters to 3rd party callback function

I have been working on a WordPress plugin and have used the do_shortcode() to implement some functionality within a form...a file upload. The upload processing comes from a 3rd party plugin and It ...
Debbie Kurth's user avatar
0 votes
1 answer
77 views

How to 'clone' select metabox options with a callback function? [closed]

Here is my metabox array( 'id' => 'all_btns', 'name' => 'Button Select', 'type' => 'select', 'options' => array( 'button' =&...
Yem's user avatar
  • 3
0 votes
1 answer
277 views

Run function after a post has finished saving - callback function perhaps?

Upon saving a new post (of a certain post type), a given operation has to run. The problem is that the operation is calling an external (slow) API, which means that the (not logget in) end-user might ...
Zeth's user avatar
  • 868
4 votes
2 answers
2k views

How to check if which hook triggered the call to a function?

I have a situation where I have a function hooked to more than one custom hooks. How to check in the callback function which custom hook triggered the call? Or the question in code will be add_action('...
ABHi's user avatar
  • 143
0 votes
0 answers
23 views

JavaScript missing from shortcode content

I am trying to add a short javascript as part of registering a WP shortcode. You can see my simplified code below. When I execute this on my website everything loads fine except for the part between ...
bistromatic's user avatar
0 votes
0 answers
983 views

CallBack URL for payment gateway redirecting to homepage instead of executing callback function

I am working on a payment plugin for Woocommerce which requires that I set the URL to redirect after payment. I set this as home_url('/?').'wc-api=WC_Payment_Gateway'. The payment gateway appends ...
Adewuyi Dare's user avatar
0 votes
1 answer
36 views

Code works, but warning about call_user_func_array() appears

I'm a newbie to Wordpress. I'm trying to make custom page that displays contact info for all users. I use code snippet provided by THIS POST. <ul> <?php $blogusers = get_users('blog_id=1&...
Sev.'s user avatar
  • 3
0 votes
0 answers
262 views

"Class Not Found" in HTML Form Target PHP File that contains the class

How do I make the HTML form's action target file 'aware' of classes that WordPress has already loaded? File A -> Creates a WordPress shortcode that inserts a form that has 'File B' as the target. ...
sacredfaith's user avatar
1 vote
1 answer
1k views

admin_notices action doesn't trigger within save_post action

After the save_post action runs, I'm attempting to also use the admin_notices action and it doesn't work. What am I doing wrong? If I move the admin_notices action into the constructor, it works fine ...
armadadrive's user avatar
1 vote
1 answer
260 views

Using shortcode content with nested shortcode

This is a shortcode example. [a][b]something[/b][/a] It should be used like this with do_shortcode($content); function a_shortcode($atts = [], $content = null) { do_shortcode($content); ...
Toniq's user avatar
  • 437
0 votes
1 answer
1k views

Update block once an API request returns with a value

I've got a block that allows the user to enter a script when in edit mode, then sends this script to a REST endpoint which returns a WP_Post representing a media file which is then displayed to the ...
Sean's user avatar
  • 647
1 vote
1 answer
327 views

settings_fields doesn't appear to be running

I'm creating a settings page for a plugin. It adds: a submenu item registers a setting adds a section adds a field and then renders the page/section/field. It is all pretty straightforward, only "...
davemackey's user avatar
1 vote
1 answer
3k views

How to insert a record by clicking on the link using AJAX

I am developing a plugin for WordPress. Looking for a solution I want to insert record (it may be any CRUD operation) when the user click on the link order-button I am very much new to Ajax so ...
pixelngrain's user avatar
  • 1,400
0 votes
1 answer
102 views

Call function with button and return response

I'm trying to do the folllowing. I have a button in my template (in templates folder of my plugin). When they press the button I want to call a function and send and id to the function. In that ...
nielsv's user avatar
  • 173
2 votes
1 answer
5k views

Can we access the REST request parameters from within the permission_callback to enforce a 401 by returning false?

From what I have tried and tested so far, the getters and setters do not work inside the function permission_callback. The alternate way would be to throw a custom 401 from the callback itself. Is ...
Muhammad Asif Mohtesham's user avatar
0 votes
1 answer
1k views

Extend Woocommerce rest api routes fails

While I'm trying to extend Woocommerce Rest-API routes with a custom one I face the following problem. I have the following class which tries to hook inside Woocommerce API class API_LOADER { ...
fefe's user avatar
  • 874
0 votes
1 answer
125 views

Warning and fatal error

I am getting this error when running my website : Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'sanitize_comment_cookies' not found or invalid function name in ...
david's user avatar
  • 1
4 votes
1 answer
2k views

WP showing "warning: call_user_func_array()", What to do?

I am currently working on designing my blog and am almost done but when I updated to 5.1 WordPress version in XAMPP, it started showing up this error message: Warning: call_user_func_array() expects ...
RIshabh Jha's user avatar
1 vote
0 answers
603 views

Callback to custom field is not working in Wordpress REST API

I'm pretty new to the REST API so please excuse any stupid questions. I'm currently trying to develop a plugin and therefore I need to register a custom post type including a custom field. This is all ...
Flo Ragossnig's user avatar
4 votes
0 answers
190 views

Hooking a callback into the code within a Gutenberg block

I want to run some JavaScript when a user uploads an image or images using the core/image block or core/gallery block. Ideally I would run my own code when the onSelectImage function is called (and ...
Sean's user avatar
  • 647
0 votes
1 answer
429 views

How to create callback function which returns all posts with specific data?

I need to create a new route all which returns only the specified fields for all posts. add_action( 'rest_api_init', function () { register_rest_route( 'custom', 'all' ,array( 'methods'...
cmii's user avatar
  • 121
4 votes
1 answer
2k views

gutenberg dynamic block is returning 404

I am trying to create a dynamic block and I followed the steps described in the documentation, but for some reason the content that is being returned from /wp-json/wp/v2/block-renderer/plugin-blocks/...
OpensaurusRex's user avatar
1 vote
2 answers
14k views

call_user_func_array expects parameter 1 to be a valid callback

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_my_admin_enqueue_scripts' not found or invalid function name in /mnt/data/vhosts/casite-961871.cloudaccess.net/...
Alan Ross's user avatar
0 votes
1 answer
58 views

Debug in WP backend

The problem - I get these warnings each time I login to /admin page in WP. Depending on which browser I use, there are problems with these: Warning: call_user_func_array() expects parameter 1 to be a ...
Mette's user avatar
  • 1
1 vote
0 answers
3k views

Creating a Callback URL for Wordpress Woocommerce to update Order Status

I want to create a Callback URL to update the order status when data in JSON format is POST to it. Post Format Example: "hash": "43745580XXXXXXXXXXXXXXXXXXXXXX", "status_feed": [{ "order_id":...
Chetanaya's user avatar
1 vote
0 answers
1k views

Shortcode function executed twice?

I use a shortcode function to do some processing as a callback from external service. I created a page, the only content of which is the shortcode. User is redirected to this page from external ...
Radovan Bezak's user avatar
1 vote
1 answer
194 views

Best practice for query_posts in responsive design?

I'm working on a responsive design desktop/mobile but I have a doubt regarding PHP calls, as the hosting provider didn't like high cpu usage. In the loop query I have something like this: <?php ...
radiobot's user avatar
1 vote
1 answer
335 views

Problems with comments callback (Argument #1 is not an array?)

I built my callback function using class-walker-comment.php as a reference and am at a loss as to why it's not working. Any help is greatly appreciated. The issues I'm encountering are: 1) Avatars ...
J. Amy's user avatar
  • 13
0 votes
0 answers
838 views

iFrame onLoad in custom Gutenberg block

I have this code that I am trying to rewrite for Gutenberg block: <script type="text/javascript"> <iframe onload="javascript:resizeIframe(this);" src="/...
ivanacorovic's user avatar
0 votes
1 answer
2k views

Website Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Wppr_Public' does not have a method 'amp_support'

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Wppr_Public' does not have a method 'amp_support' in /home1/thrfolde/public_html/3foldtraining/wp-includes/class-...
Tina Shahani's user avatar
1 vote
1 answer
330 views

Get returned variable from a function to add_shortcode function

I'm passing successfully an ajax object to the backend following this (the script in the JS really it does not matters because I'm getting it well): add_action( 'wp_ajax_my_action', '...
dfrojas's user avatar
  • 113
0 votes
0 answers
395 views

What is the proper way to call a function (from functions.php) on a link click?

When using frameworks, we have routes where we can configure a callback functions for links, in drupal too there are menus that can be used to do the same. So i would like to know if there is a proper ...
Badr's user avatar
  • 137
0 votes
1 answer
1k views

Add_action not calling callback function

I am currently trying to build a plugin for wordpress to build a settings page. But for some reason when I use add_action("admin_init", array(class_object, 'function_name')) it will run the add_action ...
user avatar
0 votes
2 answers
2k views

How To Override A WooCommerce AJAX Function

I would like to override a WP (WooCommerce AJAX function) using add_filter. The original code is set in a WC OOP class via something like: add_action( 'wp_ajax_wc_function', array( $this, '...
Ryan Dorn's user avatar
  • 349
0 votes
1 answer
949 views

Detect device change (desktop, tablet or mobile) in Customizer

In the Theme Customizer preview I am using Modernizr to include certain classes that change the page styles. If I understand it correctly, changing the device type to tablet or mobile only changes the ...
Alvaro's user avatar
  • 2,583
1 vote
1 answer
370 views

How to access $post from a callback function

I am wondering whether using global $post is a 'best practice' when it is necessary to get the $post within a callback function triggered by an action hook. The code would be: class myPlugin { ...
Pisuke Soramame's user avatar
1 vote
1 answer
3k views

How to Dynamically Load Content Into Body of Bootstrap Modal Window?

I found this answer on Stack Overflow, answer this exact question. I've modified it slightly, because I'm using a button and not an anchor: jQuery( ".modal" ).on( "show.bs.modal", function ( e ) { ...
Michael Ecklund's user avatar
0 votes
2 answers
1k views

Using Javascript Callback from plugin in a theme

I'm definitely missing some basics here. I'm using this plugin wich performs ajax actions, and then fires a js function as callback. I would like to use the callback in a custom js script of my theme....
bluantinoo's user avatar
1 vote
2 answers
1k views

How do I check if AJAX nonces are implemented correctly?

I have a simple "favorite post" button that works with AJAX. I understand that using a WordPress nonce improves security, but am not quite sure why or how it does this. This also makes me unable to ...
Swen's user avatar
  • 1,374
1 vote
0 answers
301 views

Customizer: Category Select Sanitize

as a noob I managed out to create a custom selectbox control for categories in customizer. But now I am trying to find a clever 'sanitize_callback' function in order to ensure security. Here is my ...
Friedrich Siever's user avatar
0 votes
1 answer
130 views

Callback After WordPress Customizer Complete Loading

I'm facing a problem and it is that I'm trying to select textarea inside text widget, but problem is customizer appends dynamically content inside it so I'm unable to select it. I have successfully ...
Aumkar Thakur's user avatar
1 vote
1 answer
104 views

Stop post being published

i am attempting to stop a page from being published if certain criteria are not met using the transition_post_status hook. However the WP_DIE does not stop the post from being published. function ...
frank astin's user avatar
0 votes
1 answer
3k views

Filter Hook callback error, is it due to using $this inside a filter or something else?

I'm trying to apply a filter, but I get a callback error and I'm not sure why. I think it might have to do with the fact that the filter I'm using includes a $this because I extracted the function ...
CoderScissorhands's user avatar
0 votes
1 answer
390 views

standard callback function for wp_list_comments

I know that the code for the comment is generated in Walker_Comment::comment() and for html5 themes in the method Walker_Comment::html5_comment. But if I try to copy the code from that last method ...
Marc's user avatar
  • 717