post_content ) ? 'block' : 'shortcode'; } /** * Returns the human-readable name of the page builder used to build the * given Post, or false if no supported page builder is detected. * * @since 3.4.0 * * @param int $post_id Post ID. * @return string|false */ private static function detect_page_builder( $post_id ) { // Elementor stores its content in the _elementor_data post meta key, // and flags edited posts via _elementor_edit_mode. if ( 'builder' === get_post_meta( $post_id, '_elementor_edit_mode', true ) ) { return 'Elementor'; } /** * Filters the detected page builder for a Post. * * Return a non-empty string (the page builder's name) to mark the Post * as built with an unsupported page builder, causing the Content MCP * abilities to return an error rather than writing to post_content. * * @since 3.4.0 * * @param string|false $page_builder Detected page builder name, or false. * @param int $post_id Post ID. */ return apply_filters( 'convertkit_content_post_helper_detect_page_builder', false, $post_id ); } /** * Returns a WP_Error for an unrecognised content mechanism. Acts as a * defensive fallback; detect_mechanism() should only ever return a known * mechanism or a WP_Error. * * @since 3.4.0 * * @param string $mechanism The unrecognised mechanism. * @return WP_Error */ private static function unsupported_mechanism_error( $mechanism ) { return new WP_Error( 'convertkit_content_post_helper_unsupported_mechanism', sprintf( /* translators: %s: mechanism identifier */ __( 'Unsupported content mechanism: %s.', 'convertkit' ), $mechanism ) ); } }