Flush Rewrite Rules on init or rest_api_init?

Flushing rewrite rule should not be done on routine basis, as stated per codex: Don’t do it on any hook that will triggered on a routine basis. You should either do it via the plugin activation hooks, or the theme switch hooks: add_action( ‘after_switch_theme’, ‘wpse315001_flush_rewrite_rules’ ); register_deactivation_hook( __FILE__, ‘wpse315001_flush_rewrite_rules’ ); register_activation_hook( __FILE__, ‘wpse315001_flush_rewrite_rules’ ); function … Read more

ACF attachment custom field in rest response

Check out ACF to REST API – https://github.com/airesvsg/acf-to-rest-api You can optionally turn on/off which fields you want to enable. // Enable the option show in rest add_filter( ‘acf/rest_api/field_settings/show_in_rest’, ‘__return_true’ ); // Enable the option edit in rest add_filter( ‘acf/rest_api/field_settings/edit_in_rest’, ‘__return_true’ );

WP rest api returns 404 only when author param is used

I’m facing the same problem with a Multisite running Wordfence and JWT. I’m not sure if the solution here works for your case… The following doesn’t work, it gives a 404 response. If we remove data.author it works without problem. jQuery.ajax({ url: ‘https://example.com/wp-json/wp/v2/posts’, method: ‘POST’, crossDomain: true, dataType: ‘json’, data: { ‘author’:’1′, ‘title’:’Hello world’, ‘content’:’lorem … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)