Available filters in the Speaker (for developer)

/**
* Filters html part before speak it.
*
* @since 3.0.0
*
* @param string $html Post content part.
* @param int $post_id Post ID.
**/
$html = apply_filters( 'speaker_before_part_speak', $html, $post_id );
**
* Filters $ssml content before Google Synthesis it.
*
* @since 3.0.0
*
* @param string $ssml Post content part.
* @param int $post_id Post ID.
**/
$ssml = apply_filters( 'speaker_before_synthesis', $ssml, $post_id );
/**
* Filters the post content before any manipulation.
*
* @since 3.0.0
*
* @param string $post_content Post content.
* @param int $post_id Post ID.
**/
$post_content = apply_filters( 'speaker_before_content_manipulations', $post_content, $post_id );
/**
* Filters the post content before split to parts by 4500 chars.
*
* @since 3.0.0
*
* @param string $post_content Post content.
* @param int $post_id Post ID.
**/
$post_content = apply_filters( 'speaker_before_content_dividing', $post_content, $post_id );
/**
* Filters content parts before voice_divider.
*
* @since 3.0.0
*
* @param string $parts Post content parts.
* @param int $post_id Post ID.
**/
$parts = apply_filters( 'speaker_before_voice_divider', $parts, $post_id );
/**
     * Filters content parts before adding watermarks.
     *
     * @since 3.0.0
     *
     * @param string    $parts          Post content parts.
     * @param int       $post_id        Post ID.
     **/
    $parts = apply_filters( 'speaker_before_adding_watermarks', $parts, $post_id );

Filter for managing multilang-locale in the Speaker WordPress plugin

if ( ! function_exists( 'speaker_multilang_locale' ) ) {

/**
 * Retrieves the multilingual locale for the speaker.
 * @since 4.0.14
 *
 * @param string $locale The original locale of the speaker.
 * @param int $post_id The WordPress Post ID.
 *
 * @return string The multilingual locale of the speaker.
 */
 function speaker_multilang_locale( string $locale, int $post_id ): string
{
// Do something with the $locale
// Use the $post_id to get the locale from the post meta or any other source


return $locale;
}
}
add_filter( 'speaker_multilang_locale', 'speaker_multilang_locale' );

Was this article helpful to you?