Ghazi Shah
Ghazi Shah

Reputation: 1

Fetch Data From Website - Custom Theme Development

I am developing a custom WordPress theme focused on Anime/Drama. I need to create a function in the admin panel that can fetch data from a URL, such as post categories, titles, etc. I’m not a professional developer, so I would appreciate a detailed and beginner-friendly guide on how to achieve this. Thank you!

Here the Image What I want to say: Image

Upvotes: -1

Views: 88

Answers (1)

Haroon Zaib
Haroon Zaib

Reputation: 14

you can use Php scraping libraries like html dom, curl, guzzle and much more, also can search YouTube,

  1. After scraping list categories using this WordPress built in function get_categories() check sample code here https://developer.wordpress.org/reference/functions/get_categories/

  2. And then insert post if you want using wp_insert_post() function see code details here https://developer.wordpress.org/reference/functions/wp_insert_post/

  3. Before submit post validate category using this WordPress function category_exist() with if else statement function use reference here https://developer.wordpress.org/reference/functions/category_exists/

see functions details from provided link by click on (User Contributed Notes) on right side of page.

Upvotes: -1

Related Questions