Field Editor allow field HTML to show in Admin section (for Labels, description, etc)

functions.php

<?php
add_filter( 'esc_html', 'job_manager_field_editor_allow_admin_html' );

function job_manager_field_editor_allow_admin_html( $html ){

    // We use a backtrace to check who called the esc_html
	$bt = debug_backtrace();

	// Make sure backtrace is an array, and our required keys are set
	if( ! is_array( $bt ) || ! isset( $bt[4], $bt[4]['class'], $bt[6], $bt[6]['function'] ) ){
		return $html;
	}

	// Check that esc_html was called by WP Job Manager, and it's enabled in settings
	if ( $bt[ 4 ][ 'class' ] === 'WP_Job_Manager_Writepanels' && $bt[ 6 ][ 'function' ] === 'job_listing_data' ) {
		// Return decoded HTML entities (to output actual HTML)
		return html_entity_decode( $html );
	}

	// Otherwise return back passed HTML
	return $html;
}
No comments yet.

Leave a Reply