Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Pages are not being scanned by Language Processing #164

Merged
merged 11 commits into from
Feb 26, 2020
15 changes: 13 additions & 2 deletions includes/Classifai/Admin/SavePostHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,20 @@ public function show_error_if() {
* @return bool
*/
public function is_rest_route() {
if ( isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-json/wp/v2/post' ) ) {
return true;

if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
return false;
}

// Support custome post types with custom rest base.
dinhtungdu marked this conversation as resolved.
Show resolved Hide resolved
$rest_bases = apply_filters( 'classifai_rest_bases', array( 'posts', 'pages' ) );

foreach ( $rest_bases as $rest_base ) {
if ( false !== strpos( $_SERVER['REQUEST_URI'], 'wp-json/wp/v2/' . $rest_base ) ) {
return true;
}
}

return false;
}

Expand Down
24 changes: 0 additions & 24 deletions includes/Classifai/Providers/Watson/NLU.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,30 +173,6 @@ public function enqueue_editor_assets() {
CLASSIFAI_PLUGIN_VERSION,
true
);
if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) {
wp_enqueue_script(
'classifai-gutenberg-support',
CLASSIFAI_PLUGIN_URL . 'assets/js/classifai-gutenberg-support.js',
[ 'editor' ],
CLASSIFAI_PLUGIN_VERSION,
true
);
}
}

/**
* Adds ClassifAI Gutenberg Support if on the Gutenberg editor page
*/
public function init_admin_scripts() {
if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) {
wp_enqueue_script(
'classifai-gutenberg-support',
CLASSIFAI_PLUGIN_URL . 'assets/js/classifai-gutenberg-support.js',
[ 'editor' ],
CLASSIFAI_PLUGIN_VERSION,
true
);
}
}

/**
Expand Down