Using custom php to connect to database blocks wp from accessing galery pictures

Question

I’m using simplepie to get a bunch of rss feeds and post them in a database from which I later show them on my page. I’ve added a custom php file with a shortcode to do this.

    // Connect to DB
$sDbHost = 'localhost';
$sDbName = 'database_name';
$sDbUser = 'somethin';
$sDbPwd = 'somethin';
$Conn = mysqli_connect($sDbHost, $sDbUser, $sDbPwd);
mysqli_select_db($Conn, $sDbName);

if ($Conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$get_from_table = "SELECT title, link FROM rss_news";
$result = $Conn->query($get_from_table);
mysqli_close($Conn);

The database I’m connecting to is a new one I created specifically to do this function, I also created a new user to connect to this db.

This all works, I mange to get the posts into the db and pull them from it to show on the page. The issue is that once this is active it blocks the “add file” option within the classic wordpress editor from accessing the media library.

Is there something I’m doing wrong here? Is there a better way to connect to the db to avoid blocking other connections?

0
, , Adilicious 2 years 2019-10-26T11:52:58-05:00 0 Answers 82 views 0

Leave an answer

Browse
Browse