Archived topic
Changes in functions.php not applied after updated to the GP 3.3.0
8 replies · Started by Ivaylo on March 29, 2023
Hi, I have some custom codes add to functions.php which were removed when updated to the new version of GP. I have now added them again, but looks like none of them is working.
This is the code:
add_filter( 'generate_hooks_execute_php', '__return_true' );
add_filter( 'generate_schema_type', '__return_false' );
//Remove jQuery Migrate
function dequeue_jquery_migrate( $scripts ) {
if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) {
$scripts->registered['jquery']->deps = array_diff(
$scripts->registered['jquery']->deps,
[ 'jquery-migrate' ]
);
}
}
add_action( 'wp_default_scripts', 'dequeue_jquery_migrate' );
//Remove Jquery.js
//if ( !is_admin() ) wp_deregister_script('jquery');
I've also tried to add this code:
add_filter( ‘generate_post_date_output’,’tu_add_to_post_date’ );
function tu_add_to_post_date( $output ) {
return ‘<span class=”date-label”>Updated on </span>’ . $output;
}
add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );
but it caused Wordpress critical error and the website broke.
Is there something new in GP 3.3.0 in the way it handles code in functions.php?
Hi there,
Don't add codes to the parent theme files, aside from the code being lost when updates happen you may just break something.
If you want to do that you must use a child theme:
Does adding a child theme adds more CSS and JS to my website and thus slowing it down?
Thanks!
No, adding a child theme won't impact the sites performance. Its add no extra code except what you add to it.
The <?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?> needs to be added using a Hook.
Where should it be displayed on the site ? eg. all single posts above the title.
All is good with Breadcrumbs, had to tick Execute PHP. Thanks!
Glad to hear that!