Skip to main content

vc_post_custom_css

Filters the custom CSS stored in post meta before it is output on the frontend. Use this to modify, sanitize, or extend the per-post custom CSS generated by WPBakery Page Builder.

Parameters

ParameterTypeDescription
$post_custom_cssstringThe custom CSS string retrieved from post meta.
$idintThe post ID the custom CSS belongs to.

Usage

<?php
add_filter( 'vc_post_custom_css', 'my_modify_post_custom_css', 10, 2 );

function my_modify_post_custom_css( $post_custom_css, $id ) {
// Append additional CSS for a specific post
if ( 42 === $id ) {
$post_custom_css .= ' .vc_row { max-width: 1200px; }';
}
return $post_custom_css;
}

Source

File: modules/custom-css/module.php