Jump to content

Warning: preg_replace_callback(): Requires argument 2, '…', to be a valid callback

Recommended Posts

I am getting the following warning on my wordpress website after doing an update.

Warning: preg_replace_callback(): Requires argument 2, 'stripslashes(strstr("\1", "columns=\"$columns\"") ? "\1" : "[gallery \2 \4 columns=\"$columns\"]")', to be a valid callback

I have a very basic PHP knowledge and need to get rid of this warning quickly so any help will be greatly appreciated.

Below is the code:

//FORCE GALLERY TO HAVE NO LINE BREAKS, allows for max columns.. :)

function gallery_columns($content){
$columns = 0;
$pattern = array(
$replace = 'stripslashes(strstr("\1", "columns=\"$columns\"") ? "\1" : " [gallery \2 \4 columns=\"$columns\"]")';

return preg_replace_callback($pattern, $replace, $content);


Please Help

Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.