If it’s a script you created, then move the function outside of WP CLI, where both WP CLI and your PHP script can access, and then have your WP CLI command run that function.
Related Posts:
- Running WP Cron on multisite the right way
- WP-CLI – Selecting PHP version
- WP CLI info showing correct PHP binary but wrong version of PHP
- Utilize WP-CLI from inside WordPress, not SSH
- Setting Up PHPUnit tests for WP development on Windows
- Configuring WP-CLI on Windows 10
- PHPCS: Strings should have translatable content
- Different output from WP-CLI in bash vs PHP exec()
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- PHP Parse error on WP-CLI, not on web server
- WP-CLi PHP Warning: mysqli_query(): (HY000/1356): View During Search Replace
- call to undefined function mysql_connect
- How come there is no error if I upgrade WordPress core after locking .htaccess permissions to 644?
- Full search and replace isn’t enough to make all pictures to be loaded with https
- Cannot register a custom WP-CLI command
- Uncaught Error: Class ‘WP_Upgrader_Skin’ not found
- WP-CLI PHP Deprecated Warning
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- Childs PHP files not overwriting Parent’s PHP files
- Is it safe to use $_SERVER[‘REQUEST_URI’]?
- Namespacing WordPress project according to FIG standards
- How will php 7 affect WordPress?
- How to add active class to custom menu using while loop and wp_list_pages
- How can I run a .php file located in my site’s root folder?
- Get list of WP Updates Across Sites
- WordPress Wysiwyg Content not being displayed
- Want to create Child theme, but already edited Parent theme css files and some php files
- Switching between custom templates in a post type of the admin menu
- Woocommerce HTML email option unavailable
- How to add a custom id to each post URL in wordpress
- How do I display the function the_content in this loop?
- Custom category code not showing all posts
- Custom Plugin For Converting CSV To MySQL
- What’s the best user registration library to integrate WordPress?
- WordPress add post format support not working
- Can I install/embed WordPress on a ‘single page’?
- Adding Custom Slider
- conditional logic for front-end custom field edits
- Custom posts in different columns style
- Can I use a jQuery Ajax request in Code Snippets Plugin for WordPress?
- php syntax : [ && ] between commands [closed]
- Insert custom PHP head above in WP pages
- Add user ID to woocommerce customer dashboard
- How to do a code in php and have text before it? [closed]
- Which PHP page is the Default Posts Page
- Can we count the WordPress Loop
- Need to put a script above tag in header.php – WP 5.7.1
- Add data-id attribute to child page links
- Fixing Memory Leaks in WordPress (HHVM)
- Making your own custom post views count
- How to remap one of the TinyMCE Advanced Editor button to open the wordpress media library?
- How to remove sidebar primary widget on Mobile on category page [closed]
- Conditional multidimensional arrays and array_map
- A $_POST should occur when submit form but is not?
- Argument for if term-> have child?
- difference between sanitize_email ,FILTER_VALIDATE_EMAIL and input email type in html5
- Concatenate string to the_field()
- get users search not working with array
- How to change thumbnail src attribute?
- Get wp_current_user_id using PHP and MySQL
- get_page_templates only return templates with “home” in the filename
- Show different website layout if no sidebar added
- WordPress custom taxonomy
- What does $2$3 mean? [closed]
- Writing a link cloaking plugin
- How to use wp_send_json() and output the value with ajax?
- How do you remove header sitewide from mobile only?
- Let current user know pending posts counts using wp_query
- How to check post meta isset or not empty during publish/save post?
- How to setup the Email piping in WordPress plugin?
- Gutenberg block don’t save rich text content
- how to remove a query arguments from all site urls?
- WordPress – Query specific category and automatically change category each month
- How to enable HTML tags in category description without breaking the category page
- Remove duplicates from echo output in PHP [closed]
- I can’t separate the array by commas
- Trying to get pagination working on WP_Query() post grid
- How to add locations input to user profile?
- Get original value in save_post action hooka
- Warning: urlencode() expects parameter 1 to be string, array given in /wp-includes/formatting.php on line 5343
- Multiple WordPress sites with different theme and plugin sharing the same content
- how to print total post count with 2 custom fields (date-range)
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- make an array in wordpress cusmization api?
- Gravity Forms Marketo Plugin Feed [closed]
- How to correctly add the featured immage (thumbnails) support in a WP theme? Why I can’t add a featured immage?
- apply_filters() function
- I am trying to call external database recieving error
- How can I order metaboxes in my posts in WordPress?
- wordpress taxonomy in regular posts
- Correct Syntax for uploading files to custom directory in WordPress
- Running self host server on Ubuntu, can’t increase upload limit past 2MB, tried all the solutions
- send meta box input data without publish button
- How to replace wp-admin login page to another location?
- How to find the value of the user password in wordpress and send it to another server via rest api
- How to extract URLs from wordpress taxonomies
- How to exclude first 2 posts from a specific category for a custom post type archive page
- Customize Notification Email Sent to New User When Manually Created by Site Administrator
- Woocommerce product variations getting created without attribute values selected
- How can i force replace a external js scripts language on the site itself?