I’m using WP j 0 b s t e r theme version 5 . 8 . 5 and there is this one function like fb messenger, when a user send a message to another user, the new message should appear without refresing the page but it doesn’t.
Here is the culprit
<?php
// Lighter Ajax Process Execution
define( 'DOING_AJAX', true );
// removed define WP_ADMIN true
//make sure we skip most of the loading which we might not need
//http://core.trac.wordpress.org/browser/branches/3.4/wp-settings.php#L99
define( 'SHORTINIT', true );
$absolute_path = __FILE__;
$path_to_file = explode( 'wp-content', $absolute_path );
$path_to_wp = $path_to_file[0];
require_once( $path_to_wp . '/wp-load.php' );
include_once( "light-ajax-functions.php" );
// require( ABSPATH . WPINC . '/class-wp-walker.php' );
// require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
// require( ABSPATH . WPINC . '/formatting.php' );
require( ABSPATH . WPINC . '/capabilities.php' );
require( ABSPATH . WPINC . '/class-wp-roles.php' );
require( ABSPATH . WPINC . '/class-wp-role.php' );
require( ABSPATH . WPINC . '/class-wp-user.php' );
// require( ABSPATH . WPINC . '/query.php' );
// require( ABSPATH . WPINC . '/date.php' );
// require( ABSPATH . WPINC . '/theme.php' );
// require( ABSPATH . WPINC . '/class-wp-theme.php' );
// require( ABSPATH . WPINC . '/template.php' );
require( ABSPATH . WPINC . '/user.php' );
// require( ABSPATH . WPINC . '/class-wp-user-query.php' );
require_once( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
require_once( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
// require( ABSPATH . WPINC . '/meta.php' );
// require( ABSPATH . WPINC . '/class-wp-meta-query.php' );
// require( ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php' );
// require( ABSPATH . WPINC . '/general-template.php' );
// require( ABSPATH . WPINC . '/link-template.php' );
// require( ABSPATH . WPINC . '/author-template.php' );
// require( ABSPATH . WPINC . '/post.php' );
// require( ABSPATH . WPINC . '/class-walker-page.php' );
// require( ABSPATH . WPINC . '/class-walker-page-dropdown.php' );
// require( ABSPATH . WPINC . '/class-wp-post-type.php' );
// require( ABSPATH . WPINC . '/class-wp-post.php' );
// require( ABSPATH . WPINC . '/post-template.php' );
// require( ABSPATH . WPINC . '/revision.php' );
// require( ABSPATH . WPINC . '/post-formats.php' );
// require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
// require( ABSPATH . WPINC . '/category.php' );
// require( ABSPATH . WPINC . '/class-walker-category.php' );
// require( ABSPATH . WPINC . '/class-walker-category-dropdown.php' );
// require( ABSPATH . WPINC . '/category-template.php' );
// require( ABSPATH . WPINC . '/comment.php' );
// require( ABSPATH . WPINC . '/class-wp-comment.php' );
// require( ABSPATH . WPINC . '/class-wp-comment-query.php' );
// require( ABSPATH . WPINC . '/class-walker-comment.php' );
// require( ABSPATH . WPINC . '/comment-template.php' );
// require( ABSPATH . WPINC . '/rewrite.php' );
// require( ABSPATH . WPINC . '/class-wp-rewrite.php' );
// require( ABSPATH . WPINC . '/feed.php' );
// require( ABSPATH . WPINC . '/bookmark.php' );
// require( ABSPATH . WPINC . '/bookmark-template.php' );
require( ABSPATH . WPINC . '/kses.php' );
// require( ABSPATH . WPINC . '/cron.php' );
// require( ABSPATH . WPINC . '/deprecated.php' );
// require( ABSPATH . WPINC . '/script-loader.php' );
// require( ABSPATH . WPINC . '/taxonomy.php' );
// require( ABSPATH . WPINC . '/class-wp-term.php' );
// require( ABSPATH . WPINC . '/class-wp-term-query.php' );
// require( ABSPATH . WPINC . '/class-wp-tax-query.php' );
// require( ABSPATH . WPINC . '/update.php' );
// require( ABSPATH . WPINC . '/canonical.php' );
// require( ABSPATH . WPINC . '/shortcodes.php' );
// require( ABSPATH . WPINC . '/embed.php' );
// require( ABSPATH . WPINC . '/class-wp-embed.php' );
// require( ABSPATH . WPINC . '/class-wp-oembed-controller.php' );
// require( ABSPATH . WPINC . '/media.php' );
// require( ABSPATH . WPINC . '/http.php' );
// require( ABSPATH . WPINC . '/class-http.php' );
// require( ABSPATH . WPINC . '/class-wp-http-streams.php' );
// require( ABSPATH . WPINC . '/class-wp-http-curl.php' );
// require( ABSPATH . WPINC . '/class-wp-http-proxy.php' );
// require( ABSPATH . WPINC . '/class-wp-http-cookie.php' );
// require( ABSPATH . WPINC . '/class-wp-http-encoding.php' );
// require( ABSPATH . WPINC . '/class-wp-http-response.php' );
// require( ABSPATH . WPINC . '/class-wp-http-requests-response.php' );
// require( ABSPATH . WPINC . '/widgets.php' );
// require( ABSPATH . WPINC . '/class-wp-widget.php' );
// require( ABSPATH . WPINC . '/class-wp-widget-factory.php' );
// require( ABSPATH . WPINC . '/nav-menu.php' );
// require( ABSPATH . WPINC . '/nav-menu-template.php' );
// require( ABSPATH . WPINC . '/admin-bar.php' );
require( ABSPATH . WPINC . '/rest-api.php' );
// require( ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php' );
// require( ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php' );
// require( ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php' );
// Define constants that rely on the API to obtain the default value.
// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
wp_plugin_directory_constants();
if ( is_multisite() )
ms_cookie_constants( );
// Define constants after multisite is loaded.
wp_cookie_constants();
// Define and enforce our SSL constants
wp_ssl_constants();
// Create common globals.
require( ABSPATH . WPINC . '/vars.php' );
// Load pluggable functions.
require( ABSPATH . WPINC . '/pluggable.php' ); // is_user_logged_in
// removed send_origin_headers()
// Require an action parameter
if ( empty( $_REQUEST['action'] ) ) {
die( '0' );
}
// removed require_once admin.php api
// removed require_once ajax-actions.php core ajax handlers
@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
@header( 'X-Robots-Tag: noindex' );
send_nosniff_header();
nocache_headers();
// removed do_action admin_init
// removed add_action register core ajax calls
// removed add_action heartbeat
if ( is_user_logged_in() ) {
do_action( 'light_ajax_' . $_REQUEST['action'] );
} else {
do_action( 'light_ajax_nopriv_' . $_REQUEST['action'] );
}
// Default status
die( '0' );
The Errors:
[16-Jul-2024 13:35:13 UTC] PHP Fatal error: Uncaught Error: Call to undefined function __() in /home/public_html/wj/wp-includes/pluggable.php:2450
Stack trace:
#0 /home/public_html/wj/wp-includes/pluggable.php(2516): wp_salt()
#1 /home/public_html/wj/wp-includes/pluggable.php(767): wp_hash()
#2 /home/public_html/wj/wp-includes/user.php(548): wp_validate_auth_cookie()
#3 /home/public_html/wj/wp-includes/class-wp-hook.php(324): wp_validate_logged_in_cookie()
#4 /home/public_html/wj/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#5 /home/public_html/wj/wp-includes/user.php(3632): apply_filters()
#6 /home/public_html/wj/wp-includes/pluggable.php(70): _wp_get_current_user()
#7 /home/public_html/wj/wp-includes/pluggable.php(1163): wp_get_current_user()
#8 /home/public_html/wj/wp-includes/functions.php(1493): is_user_logged_in()
#9 /home/public_html/wj/wp-includes/functions.php(1534): wp_get_nocache_headers()
#10 /home/public_html/wj/wp-content/themes/wpjobster/ajax-functions/light-ajax.php(136): nocache_headers()
#11 {main}
thrown in /home/public_html/wj/wp-includes/pluggable.php on line 2450
2024-07-16 16:00:44.909647 [NOTICE] [1487035] [T0] [127.0.0.1:51154#APVH_domain.com] [STDERR]
PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "_wp_footnotes_kses_init" not found or invalid function name in /home/public_html/wj/wp-includes/class-wp-hook.php:324n
Stack trace:n#0 /home/public_html/wj/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()n#1 /home/public_html/wj/wp-includes/plugin.php(517): WP_Hook->do_action()
n#2 /home/public_html/wj/wp-includes/pluggable.php(48): do_action()
n#3 /home/public_html/wj/wp-includes/user.php(3638): wp_set_current_user()
n#4 /home/public_html/wj/wp-includes/pluggable.php(70): _wp_get_current_user()
n#5 /home/public_html/wj/wp-includes/pluggable.php(1163): wp_get_current_user()
n#6 /home/public_html/wj/wp-includes/functions.php(1493): is_user_logged_in()
n#7 /home/public_html/wj/wp-includes/functions.php(1534): wp_get_nocache_headers()
n#8 /home/public_html/wj/wp-includes/functions.php(4014): nocache_headers()
n#9 /home/public_html/wj/wp-includes/functions.php(3785): _ajax_wp_die_handler()
n#10 /home/public_html/wj/wp-includes/class-wp-fatal-error-handler.php(241): wp_die()
n#11 /home/public_html/wj/wp-includes/class-wp-fatal-error-handler.php(156): WP_Fatal_Error_Handler->display_default_error_template()
n#12 /home/public_html/wj/wp-includes/class-wp-fatal-error-handler.php(60): WP_Fatal_Error_Handler->display_error_template()n#13 [internal function]: WP_Fatal_Error_Handler->handle()
n#14 {main}n thrown in /home/public_html/wj/wp-includes/class-wp-hook.php on line 324n
Errors on Devtools Network
here is the video https://go.screenpal.com/watch/cZiD25VPjo2
N00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
13
Your code can’t find the function __()
in WordPress, which probably means (since this is an ajax call) it hasn’t been required in the function that runs from the ajax call.
__() is included in wp-includes/l10n.php, so try requiring that path in your code and see if it changes the error message
1