You are using $post_id, but you have passed the post ID as $postID. As a result $a is always empty.
Even if it weren’t empty, there is no PHP function srtpos. It’s strpos and you could have more straightforward logic to execute set_post_format.
Wrapping it up:
function CambiarPostFormat( $postID ) {
$a = get_the_title( $postID );
if ( !has_post_format( 'image', $postID ) && strpos($a, 'imagenes') !== false)
set_post_format( $postID, 'image' );
}
Related Posts:
- How to properly insert data into custom table via plugin
- Keep one user logged for a year?
- Searching users with WP_List_Table plugin
- Generate custom output for page/URL in a plugin
- WordPress widget / plugin….fields not appearing in my widget
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Plugin to set all Posts in a certain Category to a certain Post Format
- How to turn off email you receive when registered?
- Multi step form, custom plugin
- How to send “Location” header on plugin form submit event?
- Add jQuery to WordPress page
- Custom Shipping method not showing in checkout
- From where come that JS files in ?
- Difference between register_block_type & wp.blocks.registerBlockType
- Can’t get custom posts of taxonomy to show
- Can I check plugins and themes for PHP 5.6 ahead of global PHP server Update
- Improving a Stackoverflow “inspired” badge system to display badges in author page
- how to include a simple jquery file into a wordpress plugin
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to get member list based on role by using buddypress?
- Missing argument 3 for wp_register_sidebar_widget()
- How to Include a Loop Template File in a Plugin
- get shortcode value
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Storing Options in a Shortcode
- How can I get WordPress to save comments in markdown format?
- Shortcode button dosent work for all posts. Work for first post only
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Add Product Subtitle to Woocommerce Product Page
- Theme my Login plugin, how to update fields
- CSS from textarea in options page to frontend what to do
- How do I pass a post ID to the page URL?
- How would I go about creating a user ranked post popularity page?
- WordPress: PHP code rendering in the wrong place
- New to wordpress, Question about editing PHP
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- add image crop function like in wp customizer
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- How to edit content before post update
- Bootstrap and Custom CSS in custom plugin are being overwritten by theme
- Customize permalink wordpress category id
- Take input from form and pass it to function using a wp-plugin
- Self-serve ad system like Reddit’s for WordPress? [closed]
- Create a plugin from within WordPress
- Class variables not correct on page
- WordPress call_user_func_array() expects parameter 1 to be a valid callback, class
- Call plugin with php function
- Why is my custom post type not being activated on plug-in activation?
- What happens when WordPress memory limit is exceeded?
- wp_dequeue_script for a Plugin
- How do I add $_SESSION[”] to my wordpress page?
- Built a second plugin but it overwrote the first one
- WordPress: Add custom add_filter for custom functions
- How can i add simple code in only in posts by function.php
- Hide DIV if empty – Plugin Gallery
- Profile / benchmark wordpress on apache?
- How to change layout of shop page in wordpress? [closed]
- preg_replace() No ending delimiter ‘.’ found [closed]
- Retrieve Plugin Settings and insert into XML string
- WordPress Stats Plugin: Display Post Views [closed]
- Pagination not working
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Can I disable xml-rpc by setting it to false?
- Push Contact form 7 variable to front end after submission
- Add a parameter at the end of the url and prettify
- Calling PHP function with AJAX
- Share my WordPress plugin for updating how?
- Looping the data from WordPress database using foreach
- Rename a folder via HTML POST request
- How can I change page content for good once a button is pressed?
- Google Maps for Woocommerce Checkout
- working code, not working – Plugin Dev
- Add two row of code to the public static function init of a plugin
- Get and Update Most Meta Value as an array in HTML form
- Failed to load resource: the server responded with a status of 500 () post.php
- WordPress filter from custom table is not working properly
- Configuring default woo commerce login with modal popup
- register_activation_hook doesn’t fire at all
- My ajax request don´t work and return 0
- Adding link for logged in user? [closed]
- How can I remove this sidebar from my Search Results page?
- Create csv file in plugin
- Changes required to make new plugin from existing
- Plugin Breaking WordPress Login
- How can I allow for the password protect feature to allow visitors to enter any number at all?
- How to make my plugin insert text into a custom div?
- Response from Php File to Ajax is not getting sent
- What is the source outline for a basic word press plugin?
- Submit posts in two different post types with the same form
- Allow users to download media files directly from Amazon S3 (AWS plugin)
- Like/Dislike plugin crawler problem
- How to rename files during upload to a random string?
- Redirect a specific User role not admins automatically to view the post that they just updated
- REST API – filters not working inside plugin class
- WordPress site server getting blocked due to resource abuse
- Remove H1 title in admin post edit screen
- How prevent STDOUT of Plugin_Upgrader->upgrade(…)?
- WordPress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted
- Can you open a media frame to sellect an attachment to associate with another attachment you are editing on an existing media frame?