wpseo_ajax_replace_vars

Used in the editor to replace vars for the snippet preview.

Description

wpseo_ajax_replace_vars(); 

Usage

  1. if ( !function_exists( 'wpseo_ajax_replace_vars' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpseo_ajax_replace_vars(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/admin/ajax.php  
  1. function wpseo_ajax_replace_vars() { 
  2. global $post; 
  3. check_ajax_referer( 'wpseo-replace-vars' ); 
  4.  
  5. $post = get_post( intval( filter_input( INPUT_POST, 'post_id' ) ) ); 
  6. global $wp_query; 
  7. $wp_query->queried_object = $post; 
  8. $wp_query->queried_object_id = $post->ID; 
  9. $omit = array( 'excerpt', 'excerpt_only', 'title' ); 
  10. echowpseo_replace_vars stripslashes( filter_input( INPUT_POST, 'string' ) ), $post, $omit ); 
  11. die;