BBP_Default::localize_topic_script()
Load localizations for topic script
Description
These localizations require information that may not be loaded even by init.
Source
File: bp-forums/templates/default/bbpress-functions.php
public function localize_topic_script() { // Single forum if ( bbp_is_single_forum() ) { wp_localize_script( 'bbpress-forum', 'bbpForumJS', array( 'bbp_ajaxurl' => bbp_get_ajax_url(), 'generic_ajax_error' => __( 'Something went wrong. Refresh your browser and try again.', 'buddyboss' ), 'is_user_logged_in' => is_user_logged_in(), 'subs_nonce' => wp_create_nonce( 'toggle-subscription_' . get_the_ID() ) ) ); // Single topic } elseif ( bbp_is_single_topic() ) { wp_localize_script( 'bbpress-topic', 'bbpTopicJS', array( 'bbp_ajaxurl' => bbp_get_ajax_url(), 'generic_ajax_error' => __( 'Something went wrong. Refresh your browser and try again.', 'buddyboss' ), 'is_user_logged_in' => is_user_logged_in(), 'fav_nonce' => wp_create_nonce( 'toggle-favorite_' . get_the_ID() ), 'subs_nonce' => wp_create_nonce( 'toggle-subscription_' . get_the_ID() ) ) ); } }
Changelog
Version | Description |
---|---|
bbPress (r3732) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.