Support » Plugin: Code Snippets » Use of undefined constant crop

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    The snippet you’re using contains an error – a string missing quotation marks.

    Here’s a fixed version:

    add_action( 'init', function () {
    
    	global $_wp_additional_image_sizes;
    
    	foreach ( $_wp_additional_image_sizes as $image_size => $values ){
    		if ( strpos( $image_size, TIELABS_THEME_SLUG ) !== false ){
    			$_wp_additional_image_sizes[ $image_size ][ 'crop' ] = array( 'center', 'top' );
    		}
    	}
    } );
    • This reply was modified 1 month, 3 weeks ago by Shea Bunge.
    Thread Starter Rojo Salas

    (@salasrojo)

    Hi Shea! Thank you for that.
    Unforunately I got this error:

    The code snippet you are trying to save produced a fatal error on line 3:
    syntax error, unexpected 'global' (T_GLOBAL)
    Plugin Author Shea Bunge

    (@bungeshea)

    Looks like there was a typo @salasrojo. Should be fixed now!

    Thread Starter Rojo Salas

    (@salasrojo)

    @bungeshea
    Thank you so much mate!! 🙌

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.