在WordPress中,我编写了一个自定义电子邮件注册欢迎电子邮件,覆盖了插件中的import {AutoCompleteService} from 'ionic2-auto-complete';
import { Http } from '@angular/http';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
@Injectable()
export class AutoSuggestProvider implements AutoCompleteService {
constructor(public http: HttpClient, public HTTP: Http) {
console.log('Hello AutoSuggestProvider Provider');
}
getResults(keyword:string) {
return this.HTTP.get("https://restcountries.eu/rest/v1/name/"+keyword) .map( result => { return result.filter(item => item.name.toLowerCase().startsWith(keyword.toLowerCase()) ) });
}
}
。但是当我尝试在该函数中运行wp_new_user_notification
时,查询无效。如何在插件中的WP_Query
函数内调用WP_Query
?请帮忙。
答案 0 :(得分:0)
这是因为$post->id
无法在插件中运行。相反,我使用get_the_ID()
并且它有效。