Add php function into .js file (for tinyMCE button)

To ajax this function you have hook it, so your function will be like this : function write_cat_list($cat){ $cats = get_categories(‘hide_empty=0’); if($cats) : $tinyMCE_list = array(); foreach ($cats as $cat) : $tinyMCE_list[] = array( ‘text’ => $cat->name , ‘value’ => $cat->term_id ); //write_cat_list($cat->term_id); endforeach; $jscode = json_encode($tinyMCE_list); //to convert from array to opject echo $jscode; … Read more

set new link as permalink

I would think something is wrong here: $meta = get_post_meta( $post->ID, $extlink , TRUE ); This is the function: get_post_meta( int $post_id, string $key = ”, bool $single = false ) You are setting the $extlink as the $key parameter, but it is really a meta key? From your explanation, it seems to be a … Read more