data (html) migration to posts

So I solved my problem using the wp_insert_post($array) but before I used wp_insert_post() I had to remove a filter as shown below. remove_filter(‘content_save_pre’, ‘wp_filter_post_kses’); remove_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’); // Add code to insert post(s) with html elements here $post = array( ‘post_content’ => ‘<a href=”#” title=”text”>text</a> some random text’, ); wp_insert_post($post); // Then add the filters back … Read more

wp_enqueue_script seperately for each shortcode

You’re pretty close! What you can do is to register all of the scripts via the wp_enqueue_scripts hook normally and then just enqueue them in the shortcode callback. This is telling WordPress about the scripts and then allowing you to only enqueue them as needed: add_action( ‘wp_enqueue_scripts’ ‘register_all_my_scripts’ ); function register_all_my_scripts() { wp_register_script( ‘per-pas-belanja-online’, plugins_url(‘js/per-pas-belanja-online.js’, … Read more

How do I query posts by a sub value with the API?

To access posts via meta key you need to hook into the [rest_query_vary filter].1 The example I was thinking of when I read your question is the same one found on the post @WebElaine commented. I’ve merely added it below: function my_allow_meta_query( $valid_vars ) { $valid_vars = array_merge( $valid_vars, array( ‘meta_key’, ‘meta_value’ ) ); return … Read more