I found the cause of the problem. It was shamefully simple.
I was running that piece of code from a php file that actually is a custom template being used by the plugin I’m creating. This template file is not a required file by the plugin, instead I load the template in certain occasions if needed.
Because of that, the function wp_stocks_update_all_stocks was not loaded outside the template, so WP Cron was unable to find it.
Problem solved by moving that piece of code in the main plugin .php file.
Related Posts:
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- WordPress Plugin Development – Headers Already Sent Message
- Get page content using slug
- Best practices for using the transients API
- $wpdb->insert_id
- Remove profile picture option (and other things) from profile.php (in admin)
- How to disable plugin update notification for a specific plugin in Multisite
- How Can I Add a Filter to Class Instance Only?
- Getting old term value with edited_{$taxonomy} | Hook
- How to add HTML / Form to an Admin Bar Menu
- Call activation hook multiple times
- Adding custom code into header.php using a plugin
- Building a better media uploader for WordPress
- Two-step login process – Is it possible?
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?
- Woocommerce how to update variable product price programitically?
- Singular name Plugin localization
- Using $wpdb object in a widget
- Unified Approach for Placing Option Pages
- Define a function outside a class and call the function using action or filter hook
- Modifying WordPress plugins
- On plugin deactivation hide its shortcode
- Can I submit a plugin that follows the PSR-2 coding style guide?
- How to get current page id through the plugin
- WordPress removing data attributes for scheduled post
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- WYSIWYG editor in WP 3.2 plugin
- Saving data from block editor to the database
- Verify Nonce returns false – Request Nonce returns correct value
- OOP Plugin and Menu – Call to undefined function register_setting()
- What is minimum time interval for which a cron be scheduled?
- How to untrash a post only if it was not a draft?
- Can I change header.php of current theme through a plugin function?
- Gutenberg blocks not getting styled on back end
- Writing a plugin which needs to upload files
- Calling is_single() outside the loop
- update woocommere total value on checkout based on selected payment method
- Loading WordPress Admin Environment
- how to add custom functionality after woocommerce place order button
- Problems with: manage_${post_type}_posts_columns
- Add a Save Button to Custom Meta Box [duplicate]
- Rich text editor settings persist throughout all rich text editors
- Function: Add link to / inside div
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- WP Gutenberg Blocks – How to limit first/root blocks
- Add a default WP comment form to forum template
- Gutenberg: import dependency or assign from global variable?
- How do I update a field of a meta box?
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- Steps to Update a WordPress Plugin That We Developed
- Using WAMP, trying to create a plugin, getting error: You do not have sufficient permissions to access this page
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- How do I remove folder and contents I have created while installing plugin
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Are there any official or unofficial guidelines for the styling of a widget?
- How to get error object returned by wp_create_user
- I have this error notice ‘wp_enqueue_script was called incorrectly’ in my plugin
- Logout after clicking URL link results in “headers already sent” error
- My WordPress Plugin code breaks customize.php viewpoint
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- wpdb->get_var always returning 0
- A function that will remove HTML and tags from a string?
- $wpdb->prepare is not working like mysql_real_escape_string
- Enqueue ONLY Plugin Styles and Scripts
- Setting a post’s category
- Remove Products From Category
- Foreign wp_users ID in custom plugin DB table?
- Using WordPress with WP Statistics for QR code usage survey
- Integrating a Gutenberg custom block within a larger plugin
- How to do admin ajax request in a plugin for rest api
- How to show comments from different Plugins to same post type?
- Proper way to do a page view count on a page?
- Add default value from selection
- How can I create a wp plugin with this code
- The plugin generated 683 characters of unexpected output during activation
- How to Login a User inside a Plugin and Redirect to page?
- admin-post.php form handling only working when logged in as admin
- Dont display post with no content
- Custom User Role Preview Function Not Working
- Gutenberg component in a plugin admin
- Custom Admin Plugin – Injecting repeatable select fields (add, remove) into an Ordered List
- Add_action not calling callback function
- React in plugins: REST endpoints vs. regular functions
- WordPress function is not called and ajax return 0
- Post Pagination does not working on WP-Query
- Plugin options page: grouping checkboxes
- woocommerce single product page hook not working
- Issue on Getting WP Gallery Items In cpt-single.php As Attachments
- Plugin translation not being displayed
- How do I build a settings panel under the plugin
- Show Metabox Images in slideshow instead of static
- Multiple Users Logged In Causing Incorrect Account Returned
- How to conditionally include a custom field on category editor screen not category “add” screen
- I want to display the content of a text field only if it has been entered
- Method not receiving attributes from shortcode call, general OOP problems
- How do i code exit popup plugin?
- Load images from CDN and custom features to “Add Media” dialogue
- Saving metabox updates causing fatal error